@font-face {
  font-family: "Wallie";
  src: url("assets/fonts/Wallie-Chunky.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Comfortaa";
  src: url("assets/fonts/Comfortaa.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
      --bg: #09090B;
      --card: #121214;
      --button: #D9D9D9;
      --main-text: #FFFFFF;
      --second-text: #8A8A8A;
      --button-text: #09090B;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--main-text);
  font-family: "Comfortaa", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

/* --- Сетка страницы --- */
.page {
  display: flex;
  justify-content: center;  /* центрирует весь блок */
  align-items: center;      /* по вертикали */
  width: 100%;
  min-height: 100vh;
  padding: 4vh 0;
}

/* левая часть — блок с логотипом */
.brand {
  flex: 1;                  /* занимает половину */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;  /* прижимает контент к разделяющей линии */
  padding-right: 4vw;       /* отступ от “центра” */
  box-sizing: border-box;
  margin-left: 9.72%; 
}


/* Левая колонка */
.logo {
  font-family: "Wallie", sans-serif;
  font-size: 3.61vw;
  font-weight: 400;
  margin: 0;
}
.tagline {
  color: var(--second-text);
  margin: 0;
  font-size: 2.36vw;
  text-align: left;
  margin-bottom: 2.78vw;
}

.qa {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 1.1vw; /* расстояние между иконкой и текстом */
  justify-content: flex-start;
  width: 21.67vw; /* 312px */
  height: 7.81vh; /* 80px */
  padding: 1.95vh 3vw 1.95vh 1.67vw;
  border-radius: 0.97vw;
  background: var(--button);
  color: var(--button-text);
  font-weight: 700;
  font-size: 1.25vw; /* 18px */
  text-decoration: none;
  border: 2px solid transparent;
  overflow: hidden;
  transition: all 0.35s ease;
}

.qa svg {
  width: 1.5vw;
  height: auto;
  transition: color 0.3s ease, fill 0.3s ease;
}

/* контейнер для стрелки */
.qa .qa-arr {
  position: absolute;
  right: 1.04vw; /* 15px */
  bottom: 1.46vh; /* 15px */
  width: 1.11vw; /* 16px */
  height: 1.11vw;
  display: grid;
  place-items: center;
  transition: all 0.4s ease;
}

.qa .qa-arr svg {
  width: 100%;
  height: 100%;
  transition: transform 0.4s ease;
}

/* hover-инверсия */
.qa:hover {
  background: var(--background); /* фон страницы */
  color: #fff;                  /* белый текст */
  border-color: #fff;           /* белая рамка */
}

.qa:hover svg {
  color: #fff;
  fill: #fff;
}

.qa:hover .qa-arr {
  right: 1.04vw;          /* остаётся прижатой к тому же месту */
  bottom: 50%;            /* поднимаем в центр по оси Y */
  transform: translateY(50%);
}

.qa:hover .qa-arr svg {
  transform: rotate(-45deg) scale(1.5); /* противоположный поворот */
}
/* правая часть — карточки */
.projects {
  flex: 1;                  /* занимает вторую половину */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;  /* выравниваем карточки от центра */
  padding-left: 4vw;        /* отступ от “центра” */
  gap: 2vh;
  box-sizing: border-box;
  margin-right: 9.72%; 
}

.card{
  position: relative;
  width: 44.03vw;              /* 634px при 1440 */
  height: 20.31vh;             /* 208px при 1024 */
  background: var(--card);
  border: 0.14vw solid #3a3a3e;
  border-radius: 2.43vw;
  overflow: hidden;
  display: grid;
  transition: height .35s ease;
}

/* при наведении карточка увеличивается вниз */
.card:hover {
  height: 33.01vh;
}

/* внутренняя сетка: иконка слева, контент справа */
.card-body{
  display: grid;
  grid-template-columns: 20.31vh 1fr;
  gap: 0;
  align-items: stretch;   /* было center */
  height: 100%;
  padding-right: 3.91vh;
}

/* левая иконка */
.icon{
  align-self: stretch;
  height: 100%;
  width: auto;
  display: flex;
  align-items: center;     /* чтобы картинка стояла «ровно» внутри */
  justify-content: center;
}

.icon img{
  max-height: 100%;
  max-width: 100%;
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
}
/* текстовая часть */
.content{
  align-self: center;
  /* убери padding у .content, раз мы задали его карточке целиком */
}

.title {
  margin: 0 0 0.39vh;
  font-weight: 800;
}

.desc {
  margin: 0;
  color: var(--second-text);
  font-size: clamp(16px, 1.11vw, 22px);
  line-height: 1.45;
}

/* скрытая часть */
.expand {
  grid-column: 1 / -1;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(0.78vh);
  transition: max-height .35s ease, opacity .25s ease, transform .25s ease;
  padding-bottom: 0;            /* нет нижнего отступа пока скрыт */
}

/* показать при hover */
.card:hover .expand {
  max-height: 100vh;            /* большой верхний предел для плавной анимации */
  opacity: 1;
  transform: translateY(0);
  padding-bottom: 1.95vh;       /* ← 20px по вертикали */
}

.divider {
  display: block;
  width: 80%;
  height: 0.15vh;
  background: #2e2e31;
  margin: 0 auto 1.95vh;        /* 20px от полосы до верхней кромки кнопок */
  border-radius: 1px;
}

.actions{
  display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1fr);
  column-gap: min(1.39vw, 20px);
  margin: 0 2.08vw;
  align-items: stretch;
  transition: grid-template-columns 280ms cubic-bezier(.4,0,.2,1);
}

/* КНОПКА */
.btn {
  position: relative;              /* чтобы стрелка позиционировалась внутри */
  display: flex;
  align-items: center;
  gap: 0.83vw;                     /* ≈12px между иконкой и текстом */
  width: 100%;
  height: 7.81vh;                  /* 80px */
  padding: 0 1.25vw;
  border-radius: 1.25vw;
  background: #d9d9d9;
  color: #09090B;
  font-weight: 700;
  font-size: 0.97vw;               /* 14px */
  line-height: 1.15;
  text-decoration: none;
  transition: all 0.35s ease;
}
/* ВНУТРЕННИЕ ЭЛЕМЕНТЫ */
.btn-ico{
  display: grid; place-items: center;
  width: 2.08vw;                    /* ~30px */
  height: 2.08vw;
  transition: transform 0.4s ease;
}
.btn-ico svg{ 
    width: 100%; 
    height: 100%; 
    transition: color 0.3s ease, fill 0.3s ease;
}

.btn-txt{
  align-self: center;               /* выравниваем текст по центру по вертикали */
  white-space: nowrap;              /* чтобы «telegram» не ломался на 3 строки */
}

.btn-arr {
  position: absolute;
  right: 1.04vw;   /* 15px при 1440px ширины */
  bottom: 1.46vh;  /* 15px при 1024px высоты */
  width: 1.11vw;   /* ~16px */
  height: 1.11vw;
  display: grid;
  place-items: center;
}

.btn-arr svg {
  width: 100%;
  height: 100%;
  transition: transform 0.5s ease;
}

.btn:hover {
  background: var(--card);     /* фон страницы */
  color: #fff;               /* белый текст */
  border: 2px solid #fff;    /* белая обводка */
}

/* иконки и текст внутри становятся белыми */
.btn:hover svg {
  color: #fff;
  fill: #fff;
}

/* движение и вращение стрелки */
.btn:hover .btn-arr {
  right: 1.04vw;             /* остаётся на той же оси X */
  bottom: 50%;               /* поднимается в центр по Y */
  transform: translateY(50%);
}

.btn:hover .btn-arr svg {
  transform: rotate(-45deg) scale(1.5); /* поворот в другую сторону и увеличение */
}


.api-btn {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  column-gap: 0.83vw; /* ≈12px */
}


.actions:has(.api-btn:hover){
  grid-template-columns: minmax(0,1fr) minmax(0,1fr) minmax(0,1.6fr);
}
/* контейнер с иконками */
.api-btn .btn-ico { position: relative; width: 24px; height: 24px; }
.api-btn .btn-ico svg { position: absolute; inset: 0; }
/* hover-иконка скрыта по умолчанию */
.api-btn .hover-icon { opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility .25s ease; }

/* текстовая обёртка (оба текста занимают одно место) */
.api-btn .btn-txtwrap {
  position: relative;
  width: 100%;
  min-width: 0;         /* важно, чтобы текст не распирал колонку */
  text-align: left;
}

.api-btn .btn-text,
.api-btn .btn-hover-text{
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: start; /* по левому краю */
  line-height: 1.15;
  transition: opacity .25s ease, visibility .25s ease;
}

/* скрываем hover-текст */
.api-btn .btn-hover-text {
  opacity: 0;
  visibility: hidden;
}

/* --- hover-состояние --- */
.api-btn:hover .btn-text {
  opacity: 0;
  visibility: hidden;
}
.api-btn:hover .btn-hover-text {
  opacity: 1;
  visibility: visible;
}

/* меняем иконку */
.api-btn:hover .btn-ico .default-icon { opacity: 0 !important; visibility: hidden !important; }
.api-btn:hover .btn-ico .hover-icon   { opacity: 1 !important; visibility: visible !important; }

/* можно добавить курсор */
.api-btn:hover {
  cursor: not-allowed; /* визуально понятно, что недоступно */
}

.api-btn:hover .btn-arr {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

/* стрелка внизу */
.arrow {
  position: absolute;
  right: 1.74vw;
  bottom: 2.44vh;
  width: 1.53vw;
  height: 1.53vw;
  color: #e6e6e6;
  display: grid;
  place-items: center;
  text-decoration: none;
  transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
}

.card:hover .arrow {
  opacity: 0;
  visibility: hidden;
  transform: translateY(0.5vh);
}

@media (max-width: 1024px) {
  .card {
    height: auto;          /* вместо фиксированной высоты */
  }
  .card:hover {
    height: auto;          /* убираем принудительное увеличение высоты */
  }
  .card .icon {
    margin-top: 10px;        /* создаёт визуальный отступ сверху */
  }
  .card .icon img {
    object-fit: contain;     /* чтобы картинка не обрезалась */
  }
  /* колонка иконки больше не зависит от высоты окна */
  .card-body {
    grid-template-columns: 140px 1fr;
    align-items: start;
  }
  .icon { height: 140px; }
  .icon img { height: 100%; width: auto; object-fit: contain; }

  /* нужные отступы для текста */
  .card .title { margin-top: 20px; }
  .card .desc  { margin-bottom: 20px; }
}

@media (max-width: 880px) {
  /* Общая структура страницы */
  .page {
    flex-direction: column;    /* brand сверху, карточки под ним */
    align-items: stretch; 
    gap: 0;
  }
  .brand {
    align-self: flex-start;      /* перестаёт центрироваться как элемент */
    align-items: flex-start;     /* контент внутри тоже у левого края */
    margin-left: 9.72%;          /* твой текущий отступ можно оставить; при желании уменьшай */
    width: auto;
  }
  .qa {
    height: 0;
  }

  .projects {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: start;
    justify-content: start;
    gap: 20px;
    margin-right: 0;
    padding-left: 0;
  }

  /* Карточки теперь идут на всю ширину */
  .card {
    width: 90%;
    max-width: 700px;
    height: auto;
    margin: 0 auto;
  }

  /* Оставляем внутреннюю сетку горизонтальной! */
  .card-body {
    display: grid;
    grid-template-columns: 120px 1fr;  /* иконка + контент */
    gap: 20px;
    align-items: center;
  }

  .card .desc {
    margin-bottom: 0;
  }

  .icon {
    width: 120px;
    height: 120px;
    display: grid;
    place-items: center;
  }

  .icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* Контент справа от иконки */
  .content {
    text-align: left;
  }

   .content .title {
    font-size: 1.2em;            /* было ~1.5em у h2, уменьшаем на ~20% */
  }
  .content .desc {
    margin-top: 10px;
    font-size: calc(clamp(16px, 1.11vw, 22px) * 0.8);
    line-height: 1.45;
  }

  /* Расширяем кнопку по ширине карточки */
  .actions {
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    justify-items: center;
  }

  .btn {
    width: 100%;
    font-size: 14px;          /* вместо 0.97vw */
    padding: 0 16px; 
  }
  .btn-ico{
    width: 24px;              /* вместо 2.08vw (~16px) */
    height: 24px;
  }
  .btn-arr{
    width: 16px;              /* вместо 1.11vw (~8–9px) */
    height: 16px;
  }
  .btn:hover .btn-arr{
    right: 16px;
    bottom: 50%;
    transform: translateY(50%);
  }
  .api-btn .btn-ico{
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .api-btn .btn-arr {
    bottom: 10px;
  }

  .api-btn .btn-txtwrap{
    position: relative;
    align-self: stretch;
    height: 100%;
    display: block;           /* не flex, чтобы не мешать абсолютным слоям */
    min-width: 0;
    text-align: left;
  }

  .api-btn .btn-text,
  .api-btn .btn-hover-text{
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;      /* вертикальный центр */
    justify-content: flex-start;
    margin: 0;
    line-height: 1.2;
    pointer-events: none;     /* на всякий случай */
  }
  .api-btn > .btn-ico,
  .api-btn > .btn-arr {
    align-self: center;
  }
  .arrow {
    right: 3.5vw;                /* было ~1.74vw */
    bottom: 3.5vh;               /* было ~2.44vh */
  }
}

@media (max-width: 530px) {
    .logo {
        font-size: 4.5vw;
    }
    .qa {
        font-size: 1.8vw;
        padding: 2.8vh 3vw 2.8vh 1.67vw;
        width: auto;
    }
    .qa svg {
        width: 3vw;
    }
    .qa .qa-arr {
        width: 2.22vw;
        height: 2.22vw;
        bottom: 0.46vw;
        right: 0.46vw;
    }
    .content .title {
        font-size: 1em;
        margin-top: 0;
    }
    .content .desc {
        font-size: calc(clamp(16px, 1.11vw, 22px) * 0.7);
    }
    .card-body {
        gap:0;
    }
    .btn {
        font-size: 10px;
        gap: 1.83vw;
    }
    .card .icon {
        margin-top: 0;
    }
    .arrow {
        right: 4.5vw;
        bottom: 3.5vh;
    }
    .btn:hover .btn-arr svg {
        opacity: 0;
        visibility: hidden;
        transform: translateY(0.5vh);
    }
}

@media (max-width: 425px) {
    .card-body {
        justify-content: space-between;
    }
    .actions{
        grid-template-columns: repeat(2, minmax(0,1fr)); /* две колонки */
        column-gap: 12px;
        row-gap: 12px;
        margin: 0;                                      /* можно убрать боковые поля у ряда */
    }
    .actions .btn:nth-child(3){
        grid-column: 1 / -1;   /* во всю ширину сетки */
        width: 100%;
    }
    .actions:has(.api-btn:hover){
        grid-template-columns: repeat(2, minmax(0,1fr));
    }
    .content .title {
        margin-top: 10px;
    }
    .content .desc {
        margin-top: 0;
        margin-bottom: 10px;
    }
    .logo {
        font-size: 6.2vw;
    }
    .tagline {
        font-size: 3.36vw;
    }
    .qa {
        width: auto;
        font-size: 3vw;
        padding: 2.8vh 6vw 2.8vh 1.67vw
    }
    .qa svg {
        width: 4.2vw;
    }
    .qa .qa-arr {
        width: 3.33vw;
        height: 3.33vw;
    }
    .icon {
        width: 100px;
        height: 100px;
    }
    .content .title {
        font-size: 0.9em;
    }
    .btn{ width: 100%; } 
    .arrow {
        right: 5.5vw;
    }
}
@media (max-width: 320px) {
    .arrow {
        right: 7.5vw;
    }
    .card {
    display: flex;
    align-items: center; /* Центрируем всё по вертикали */
    justify-content: flex-start;
    gap: 12px; /* Расстояние между иконкой и текстом */
    flex-wrap: nowrap;
  }

  .card-body{
    grid-template-columns: 100px 1fr;  /* иконка + текст */
    align-items: center !important;    /* ← ключ! перебивает align-items:start */
    gap: 12px;
  }

  /* 2) .icon точно без внешних отступов и по центру своей ячейки */
  .card .icon{
    margin-top: 0 !important;
    align-self: center;                 /* если вдруг у ячеек разные выравнивания */
    height: 100px;
    width: 100px;
    display: grid;
    place-items: center;                /* центр внутри квадрата */
  }

  /* 3) изображение без baseline-зазора и по контейнеру */
  .card .icon img{
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
  }

  .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center; /* выравниваем текст по вертикали относительно картинки */
  }
}