/* === Переменные === */
:root {
  --primary: #0d9488;
  --primary-light: #14b8a6;
  --primary-pale: #f0fdfa;
  --secondary: #0891b2;
  --warm: #f0fdfa;
  --bg: #fafafa;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-secondary: #555770;
  --text-muted: #8b8da3;
  --border: #eaeaf0;
  --border-light: #f2f2f7;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow: 0 4px 20px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.1);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Сброс === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-light);
}

/* === Hero === */
.hero {
  position: relative;
  overflow: hidden;
  padding: 64px 24px 80px;
  text-align: center;
  color: #fff;
}

.hero__bg {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0d9488 0%, #14b8a6 40%, #06b6d4 100%);
  z-index: 0;
}

.hero__bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(255,255,255,0.15) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%);
}

.hero__content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
}

.hero__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,0.2);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  margin-bottom: 24px;
  color: #fff;
}

.hero__title {
  font-size: 3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
}

.hero__title span {
  opacity: 0.7;
  font-weight: 600;
}

.hero__subtitle {
  font-size: 1.15rem;
  opacity: 0.9;
  font-weight: 400;
  line-height: 1.5;
  max-width: 480px;
  margin: 0 auto 32px;
}

.hero__stats {
  display: inline-flex;
  align-items: center;
  gap: 24px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(10px);
  border-radius: 16px;
  padding: 16px 32px;
}

.hero__stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hero__stat-num {
  font-size: 1.5rem;
  font-weight: 700;
}

.hero__stat-label {
  font-size: 0.8rem;
  opacity: 0.8;
  font-weight: 500;
}

.hero__stat-divider {
  width: 1px;
  height: 32px;
  background: rgba(255,255,255,0.3);
}

/* === Main === */
.main {
  margin-top: -40px;
  position: relative;
  z-index: 10;
  padding-bottom: 40px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* === Панель поиска === */
.search-panel {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  margin-bottom: 28px;
}

.search-panel__bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-panel__bar:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-pale);
}

.search-panel__icon {
  color: var(--text-muted);
  flex-shrink: 0;
}

.search-panel__input {
  flex: 1;
  border: none;
  background: transparent;
  padding: 12px 0;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
}

.search-panel__input::placeholder {
  color: var(--text-muted);
}

.search-panel__clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.search-panel__clear:hover {
  background: var(--primary-pale);
  color: var(--primary);
}

.search-panel__filters {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 16px;
  flex-wrap: wrap;
}

.search-panel__tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.search-panel__select {
  padding: 8px 32px 8px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xs);
  font-size: 0.875rem;
  font-family: inherit;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8da3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 10px center;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  outline: none;
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-panel__select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-pale);
}

/* === Теги фильтров === */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 7px 14px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 0.825rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  user-select: none;
}

.tag:hover {
  border-color: var(--primary-light);
  color: var(--primary);
  background: var(--primary-pale);
}

.tag--active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.tag--active:hover {
  background: var(--primary-light);
  border-color: var(--primary-light);
  color: #fff;
}

/* === Results bar === */
.results-bar {
  margin-bottom: 20px;
}

.results-bar__text {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
}

.results-bar__text strong {
  color: var(--primary);
  font-weight: 700;
}

/* === Сетка карточек === */
.funds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* === Карточка фонда === */
.fund-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  border: 1.5px solid var(--border-light);
  overflow: hidden;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
}

.fund-card:hover {
  border-color: var(--border);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.fund-card__header {
  padding: 24px 24px 0;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.fund-card__avatar {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  font-weight: 700;
  flex-shrink: 0;
  color: #fff;
}

.fund-card__info {
  flex: 1;
  min-width: 0;
}

.fund-card__name {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 4px;
}

.fund-card__target {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  line-height: 1.4;
}

.fund-card__body {
  padding: 16px 24px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.fund-card__region {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  font-weight: 500;
}

.fund-card__region svg {
  flex-shrink: 0;
  color: var(--primary);
}

.fund-card__description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.65;
  margin-bottom: 16px;
  flex: 1;
}

.fund-card__footer {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 16px;
  border-top: 1.5px solid var(--border-light);
}

.fund-card__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg);
  border-radius: var(--radius-xs);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.fund-card__btn:hover {
  background: var(--primary-pale);
  color: var(--primary);
  border-color: var(--primary-pale);
  text-decoration: none;
}

.fund-card__btn svg {
  flex-shrink: 0;
}

.fund-card__btn--site {
  background: var(--primary);
  color: #fff;
}

.fund-card__btn--site:hover {
  background: var(--primary-light);
  color: #fff;
  border-color: var(--primary-light);
}

.fund-card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 12px;
}

.fund-card__tag {
  padding: 3px 10px;
  background: var(--warm);
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--secondary);
}

/* === Пустое состояние === */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
  grid-column: 1 / -1;
}

.empty-state__icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state__text {
  font-size: 1.05rem;
  font-weight: 500;
}

/* === Кнопка наверх === */
.scroll-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: all var(--transition);
  z-index: 100;
}

.scroll-top--visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-top:hover {
  background: var(--primary-light);
  box-shadow: var(--shadow-lg);
}

/* === Футер === */
.footer {
  background: var(--text);
  color: rgba(255,255,255,0.7);
  padding: 40px 20px;
  margin-top: 40px;
}

.footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.footer__logo {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}

.footer__desc {
  font-size: 0.85rem;
  margin-top: 4px;
}

.footer__copy {
  font-size: 0.8rem;
  opacity: 0.6;
}

/* === Анимация появления === */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fund-card {
  animation: fadeUp 0.4s ease both;
}

.fund-card:nth-child(1) { animation-delay: 0.03s; }
.fund-card:nth-child(2) { animation-delay: 0.06s; }
.fund-card:nth-child(3) { animation-delay: 0.09s; }
.fund-card:nth-child(4) { animation-delay: 0.12s; }
.fund-card:nth-child(5) { animation-delay: 0.15s; }
.fund-card:nth-child(6) { animation-delay: 0.18s; }

/* === Адаптивность === */
@media (max-width: 768px) {
  .hero {
    padding: 48px 20px 64px;
  }

  .hero__icon {
    width: 64px;
    height: 64px;
    border-radius: 20px;
  }

  .hero__icon svg {
    width: 40px;
    height: 40px;
  }

  .hero__title {
    font-size: 2.2rem;
  }

  .hero__subtitle {
    font-size: 1rem;
  }

  .hero__stats {
    gap: 16px;
    padding: 12px 20px;
  }

  .hero__stat-num {
    font-size: 1.2rem;
  }

  .main {
    margin-top: -30px;
  }

  .search-panel {
    padding: 16px;
  }

  .search-panel__filters {
    flex-direction: column;
  }

  .search-panel__select {
    width: 100%;
  }

  .funds-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .footer__inner {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .hero {
    padding: 36px 16px 56px;
  }

  .hero__title {
    font-size: 1.8rem;
  }

  .hero__stats {
    gap: 12px;
    padding: 10px 16px;
    flex-wrap: wrap;
    justify-content: center;
  }

  .fund-card__header {
    padding: 20px 20px 0;
  }

  .fund-card__body {
    padding: 14px 20px 18px;
  }
}
