/* ==========================================================================
   Главная страница (views/home.php)
   ========================================================================== */

.hp {
  --hp-radius: 1rem;
  --hp-ink: #2a3a5c;
  padding-bottom: 4.5rem;
}

.hp-h2 {
  font-size: 1.875rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.015em;
}

.hp-h4 {
  font-size: 1rem;
  font-weight: 700;
}

.hp-muted {
  color: var(--c-muted);
}

.hp-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 3rem;
  height: 3rem;
  color: var(--c-blue);
  background: var(--c-soft);
  border-radius: 0.75rem;
}

.hp-icon .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.hp-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--c-blue);
}

.hp-link .icon {
  width: 1rem;
  height: 1rem;
}

/* Ссылка на всю карточку */
.hp-stretched::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.hp-badge {
  display: inline-block;
  padding: 0.3125rem 0.625rem;
  font-size: 0.6875rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--c-navy);
  background: #fff;
  border-radius: 0.375rem;
}

.hp-badge--dark {
  color: #fff;
  background: var(--c-navy);
}

.hp-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  font-size: 0.8125rem;
}

.hp-meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.hp-meta .icon {
  width: 0.9375rem;
  height: 0.9375rem;
}

/* Заглушка вместо картинки статьи */
.is-empty {
  display: block;
  background: linear-gradient(135deg, #dfe9f8, #c7d8f3);
}

/* --------------------------------------------------------------------------
   Первый экран
   -------------------------------------------------------------------------- */

.hp-hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #f3f7fd 0%, #fff 100%);
}

.hp-hero::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 64%;
  background: var(--hero-img) center / cover no-repeat;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .75) 22%, #000 40%);
  mask-image: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, .75) 22%, #000 40%);
}

.hp-hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 30%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, .85));
  pointer-events: none;
}

.hp-hero__box {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
  min-height: 32rem;
  padding-block: 4.5rem 3rem;
}

.hp-hero__content {
  align-self: center;
  max-width: 37rem;
}

.hp-hero__title {
  font-size: 4rem;
  line-height: 1.06;
  font-weight: 800;
  letter-spacing: -.025em;
}

.hp-hero__lead {
  max-width: 31rem;
  margin-top: 1.5rem;
  font-size: 1.1875rem;
  line-height: 1.5;
  color: var(--hp-ink);
}

.hp-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 2.25rem;
}

.hp-hero__widget {
  display: flex;
  flex: none;
  align-items: stretch;
  padding: 1.125rem 1.25rem;
  background: rgba(255, 255, 255, .92);
  -webkit-backdrop-filter: blur(0.5rem);
  backdrop-filter: blur(0.5rem);
  border-radius: var(--hp-radius);
  box-shadow: 0 0.75rem 2rem rgba(7, 29, 73, .12);
}

.hp-hero__label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--hp-ink);
}

.hp-hero__usd {
  position: relative;
  width: 17rem;
  padding-right: 1.25rem;
}

.hp-hero__num {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-top: 0.375rem;
}

.hp-hero__num strong,
.hp-hero__base-value {
  font-family: var(--font-head);
  font-size: 1.625rem;
  line-height: 1.1;
  font-weight: 700;
}

.hp-hero__spark {
  display: block;
  width: 100%;
  height: 3rem;
  margin-top: 0.25rem;
}

.hp-hero__base {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding-left: 1.25rem;
  border-left: 0.0625rem solid var(--c-line);
}

.hp-hero__source {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-top: auto;
  font-size: 0.8125rem;
  color: var(--c-muted);
}

.hp-hero__source .icon {
  width: 1.75rem;
  height: 1.75rem;
  color: var(--c-blue);
  stroke-width: 2.2;
}

/* Изменение курса и мини-графики */
.hp-rate__change {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.is-up { color: var(--c-up); }
.is-down { color: var(--c-down); }
.is-flat { color: var(--c-muted); }

/* --------------------------------------------------------------------------
   Разделы
   -------------------------------------------------------------------------- */

.hp-sections {
  position: relative;
  z-index: 1;
  margin-top: 1.5rem;
}

.hp-sections__list {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.875rem;
}

.hp-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  padding: 1.125rem 0.5rem 1rem;
  text-align: center;
  background: #fff;
  border: 0.0625rem solid var(--c-line);
  border-radius: var(--hp-radius);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}

.hp-section:hover {
  border-color: rgba(22, 119, 255, .4);
  box-shadow: var(--shadow-card);
  transform: translateY(-0.125rem);
}

.hp-section__title {
  margin-top: 0.75rem;
  font-size: 0.9375rem;
  font-weight: 600;
}

.hp-section__sub {
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: var(--c-muted);
}

/* --------------------------------------------------------------------------
   Новости
   -------------------------------------------------------------------------- */

.hp-news {
  margin-top: 2.5rem;
}

.hp-news__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 1.5rem;
}

.hp-lead {
  position: relative;
  display: flex;
  align-items: flex-end;
  min-height: 26rem;
  overflow: hidden;
  color: #fff;
  background: var(--c-navy);
  border-radius: var(--hp-radius);
}

.hp-lead__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .5s;
}

.hp-lead:hover .hp-lead__img {
  transform: scale(1.03);
}

.hp-lead::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(7, 29, 73, 0) 35%, rgba(7, 29, 73, .88) 100%);
}

.hp-lead__body {
  position: relative;
  z-index: 2;
  padding: 2rem;
}

.hp-lead__title {
  max-width: 34rem;
  margin: 0.875rem 0 1rem;
  font-size: 1.875rem;
  line-height: 1.2;
  font-weight: 700;
}

.hp-lead .hp-meta {
  color: rgba(255, 255, 255, .8);
}

.hp-feed {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.hp-feed__list {
  width: 100%;
  margin-bottom: 1rem;
}

.hp-feed__item {
  position: relative;
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding-block: 0.875rem;
  border-bottom: 0.0625rem solid var(--c-line);
}

.hp-feed__item:first-child {
  padding-top: 0;
}

.hp-feed__img {
  width: 100%;
  height: 4.75rem;
  object-fit: cover;
  border-radius: 0.5rem;
}

.hp-feed__title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font-size: 0.9375rem;
  line-height: 1.35;
  font-weight: 700;
  transition: color .2s;
}

.hp-feed__item:hover .hp-feed__title {
  color: var(--c-blue);
}

.hp-feed__date {
  margin-top: 0.375rem;
  font-size: 0.8125rem;
  color: var(--c-muted);
}

/* --------------------------------------------------------------------------
   Данные и инструменты
   -------------------------------------------------------------------------- */

.hp-data {
  margin-top: 3.5rem;
}

.hp-data__box {
  padding: 2.25rem 2.5rem 2.5rem;
  background: linear-gradient(180deg, #f2f6fd 0%, #edf2fb 100%);
  border-radius: 1.5rem;
}

.hp-data__top {
  display: grid;
  grid-template-columns: minmax(0, 0.36fr) minmax(0, 0.64fr);
  gap: 2.5rem;
}

.hp-data__intro .hp-h2 {
  max-width: 22rem;
}

.hp-data__intro .hp-muted {
  max-width: 21rem;
  margin-top: 0.875rem;
  font-size: 0.9375rem;
}

.hp-tabs__list {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.hp-tabs__tab {
  padding: 0.25rem 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-muted);
  background: none;
  border: 0;
  border-bottom: 0.125rem solid transparent;
  transition: color .2s, border-color .2s;
}

.hp-tabs__tab:hover {
  color: var(--c-navy);
}

.hp-tabs__tab[aria-selected="true"] {
  font-weight: 600;
  color: var(--c-navy);
  border-bottom-color: var(--c-blue);
}

.hp-rates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.875rem;
}

.hp-rates[hidden] {
  display: none;
}

.hp-rate {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.125rem;
  background: #fff;
  border-radius: 0.875rem;
}

.hp-rate--wide {
  grid-column: 1 / -1;
}

.hp-rate__code {
  font-size: 0.8125rem;
  font-weight: 600;
}

.hp-rate__value {
  margin-top: 0.25rem;
  font-family: var(--font-head);
  font-size: 1.5rem;
  line-height: 1.2;
  font-weight: 700;
}

.hp-rate__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.5rem;
  font-size: 0.8125rem;
}

.hp-rate__spark {
  width: 3.75rem;
  height: 1.625rem;
}

.hp-data__bottom {
  display: grid;
  grid-template-columns: minmax(0, 0.72fr) minmax(0, 0.28fr);
  align-items: end;
  gap: 1rem;
  margin-top: 2.25rem;
}

.hp-calcs .hp-h4 {
  margin-bottom: 0.875rem;
}

.hp-calcs__list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.875rem;
}

.hp-calc,
.hp-rating {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  height: 100%;
  padding: 0.875rem 1rem;
  background: #fff;
  border: 0.0625rem solid transparent;
  border-radius: 0.875rem;
  transition: border-color .2s, box-shadow .2s;
}

.hp-calc:hover,
.hp-rating:hover {
  border-color: rgba(22, 119, 255, .35);
  box-shadow: var(--shadow-card);
}

.hp-calc__text {
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--c-muted);
}

.hp-calc__text b {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-navy);
}

.hp-rating {
  align-items: flex-start;
  padding: 1.25rem;
}

.hp-icon--star {
  color: #f5a623;
  background: #fff6e0;
}

.hp-rating__title {
  display: block;
  font-size: 0.9375rem;
  font-weight: 700;
}

.hp-rating__text {
  display: block;
  margin: 0.25rem 0 0.625rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--c-muted);
}

/* --------------------------------------------------------------------------
   Аналитика
   -------------------------------------------------------------------------- */

.hp-analytics {
  margin-top: 3.5rem;
}

.hp-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.hp-head .hp-muted {
  margin-top: 0.375rem;
  font-size: 0.9375rem;
}

.hp-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem;
}

.hp-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 0.0625rem solid var(--c-line);
  border-radius: var(--hp-radius);
  transition: box-shadow .2s, transform .2s;
}

.hp-card:hover {
  box-shadow: 0 0.75rem 1.75rem rgba(7, 29, 73, .1);
  transform: translateY(-0.125rem);
}

.hp-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
}

.hp-card__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hp-card__media .hp-badge {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
}

.hp-card__title {
  padding: 1.125rem 1.25rem 0;
  font-size: 1rem;
  line-height: 1.35;
  font-weight: 700;
  transition: color .2s;
}

.hp-card:hover .hp-card__title {
  color: var(--c-blue);
}

.hp-card__date {
  margin-top: auto;
  padding: 1.25rem 1.25rem 1.125rem;
  font-size: 0.8125rem;
  color: var(--c-muted);
}

/* --------------------------------------------------------------------------
   Адаптив
   -------------------------------------------------------------------------- */

@media (max-width: 1240px) {
  .hp-hero__title {
    font-size: 3.5rem;
  }

  .hp-calc {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.625rem;
  }
}

@media (max-width: 999px) {
  .hp-calc {
    flex-direction: row;
    align-items: center;
  }
}

@media (max-width: 999px) {
  .hp-hero::before {
    width: 100%;
    opacity: .85;
    -webkit-mask-image: linear-gradient(90deg, transparent 25%, rgba(0, 0, 0, .45) 60%, #000 100%);
    mask-image: linear-gradient(90deg, transparent 25%, rgba(0, 0, 0, .45) 60%, #000 100%);
  }

  .hp-hero__box {
    flex-direction: column;
    align-items: flex-start;
    min-height: 0;
    padding-block: 3rem 2rem;
  }

  .hp-hero__content {
    align-self: auto;
  }

  .hp-hero__title {
    font-size: 3rem;
  }

  .hp-sections__list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .hp-news__grid,
  .hp-data__top,
  .hp-data__bottom {
    grid-template-columns: minmax(0, 1fr);
  }

  .hp-data__top {
    gap: 1.5rem;
  }

  .hp-data__intro .hp-h2,
  .hp-data__intro .hp-muted {
    max-width: none;
  }

  .hp-calcs__list,
  .hp-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .hp-rates {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .hp {
    padding-bottom: 3rem;
  }

  .hp-h2 {
    font-size: 1.5rem;
  }

  .hp-hero__box {
    padding-block: 2rem 1.5rem;
  }

  .hp-hero__title {
    font-size: 2.25rem;
  }

  .hp-hero__lead {
    margin-top: 1rem;
    font-size: 1rem;
  }

  .hp-hero__actions {
    margin-top: 1.5rem;
  }

  .hp-hero__rates-link,
  .hp-hero__base {
    display: none;
  }

  .hp-hero__widget {
    width: 100%;
  }

  .hp-hero__usd {
    width: 100%;
    padding-right: 0;
  }

  .hp-sections {
    margin-top: 1.25rem;
  }

  .hp-sections__list {
    gap: 0.5rem;
  }

  .hp-section {
    padding: 0.75rem 0.25rem;
    border-radius: 0.75rem;
  }

  .hp-section .hp-icon {
    width: 2.5rem;
    height: 2.5rem;
  }

  .hp-section__title {
    margin-top: 0.5rem;
    font-size: 0.6875rem;
  }

  .hp-section__sub {
    display: none;
  }

  .hp-news {
    margin-top: 1.75rem;
  }

  .hp-lead {
    min-height: 20rem;
  }

  .hp-lead__body {
    padding: 1.25rem;
  }

  .hp-lead__title {
    font-size: 1.375rem;
  }

  .hp-feed__item {
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: 0.875rem;
  }

  .hp-feed__img {
    height: 4rem;
  }

  .hp-data,
  .hp-analytics {
    margin-top: 2.5rem;
  }

  .hp-data__box {
    margin-inline: calc(var(--gutter) * -0.5);
    padding: 1.5rem 1rem;
    border-radius: 1.25rem;
  }

  .hp-calcs__list,
  .hp-cards {
    grid-template-columns: minmax(0, 1fr);
  }

  .hp-head {
    flex-direction: column;
    align-items: flex-start;
  }
}
