/* =========================================================
  history-section.css
  Блок #history / “Традиція, що виховує лідерів”
  Оновлена версія 07:
  - виправлено вилазання слова “Відповідальність”;
  - цінності стали гнучкішими;
  - текст у картках переноситься коректно.
========================================================= */

.history-section {
  position: relative;
  overflow: visible;
  padding: 84px 0;
  color: var(--ink);
  background: transparent;
}

.history-section::before {
  content: "";
  position: absolute;
  left: -150px;
  top: 70px;
  width: 430px;
  height: 430px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91, 16, 166, 0.08), transparent 62%);
  pointer-events: none;
}

.history-compact-layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.82fr);
  gap: 34px;
  align-items: center;
}

.history-kicker {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  color: var(--purple);
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.history-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(38px, 5.2vw, 68px);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.055em;
}

.history-subtitle {
  margin: 16px 0 0;
  max-width: 860px;
  color: var(--forest);
  font-size: clamp(19px, 2.1vw, 25px);
  line-height: 1.42;
  font-weight: 800;
}

.history-main-text {
  margin: 22px 0 0;
  max-width: 820px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.72;
}

/* Скляна фото-картка */
.history-visual-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.50);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.54), rgba(255, 255, 255, 0.28));
  box-shadow: 0 24px 70px rgba(45, 39, 35, 0.13);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}

.history-main-photo {
  min-height: 300px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(13, 43, 32, 0.05), rgba(13, 43, 32, 0.16)),
    url("../assets/history-karpaty-tradition.jpg");
  background-size: cover;
  background-position: center;
  border: 1px solid rgba(255, 255, 255, 0.46);
}

.history-credo {
  margin-top: 14px;
  display: grid;
  place-items: center;
  min-height: 86px;
  padding: 18px;
  border-radius: 26px;
  color: var(--yellow);
  background:
    radial-gradient(circle at 90% 20%, rgba(255, 220, 29, 0.18), transparent 28%),
    linear-gradient(135deg, var(--purple), var(--purple-deep));
  box-shadow: 0 18px 48px rgba(91, 16, 166, 0.20);
  text-align: center;
}

.history-credo strong {
  color: var(--yellow);
  font-size: clamp(30px, 3.8vw, 48px);
  line-height: 1.04;
  font-weight: 900;
  letter-spacing: -0.05em;
}

/* Скляна нижня плашка цінностей */
.history-values-mini {
  position: relative;
  z-index: 1;
  margin-top: 34px;
  padding: 22px;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.50);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.48), rgba(255, 255, 255, 0.25));
  box-shadow: 0 24px 70px rgba(45, 39, 35, 0.11);
  backdrop-filter: blur(22px) saturate(160%);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
}

.history-values-mini-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.history-values-mini-header span {
  color: var(--purple);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.045em;
}

.history-values-mini-header p {
  margin: 0;
  max-width: 650px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

/* Головна правка:
   Замість жорстких 5 колонок — гнучкі картки.
   Так слово “Відповідальність” не вилазить за межі. */
.history-values-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.history-value-mini {
  min-width: 0;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  min-height: 78px;
  padding: 10px;
  border-radius: 22px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.38));
  border: 1px solid rgba(255, 255, 255, 0.50);
  box-shadow: 0 14px 36px rgba(45, 39, 35, 0.08);
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.history-value-mini:hover {
  transform: translateY(-4px);
  box-shadow: 0 22px 52px rgba(45, 39, 35, 0.13);
}

.history-value-mini img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 17px;
}

.history-value-mini div {
  min-width: 0;
}

.history-value-mini h3 {
  margin: 0 0 2px;
  color: var(--ink);
  font-size: clamp(13.5px, 0.95vw, 16px);
  line-height: 1.08;
  font-weight: 900;
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.history-value-mini p {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

@media (max-width: 1180px) {
  .history-values-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .history-compact-layout {
    grid-template-columns: 1fr;
    gap: 26px;
  }

  .history-content {
    max-width: 780px;
  }

  .history-visual-card {
    width: 100%;
    max-width: 760px;
    justify-self: center;
  }

  .history-main-photo {
    min-height: 280px;
  }
}

/* =========================================================
  MOBILE FIX: Цінності КЛБ у дії
  Виправляє стискання карток і перенесення тексту по літерах
========================================================= */

@media (max-width: 1180px) {
  .history-values-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .history-values-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-value-mini {
    grid-template-columns: 54px minmax(0, 1fr);
    align-items: center;
  }
}

@media (max-width: 560px) {
  .history-values-grid {
    grid-template-columns: 1fr;
  }

  .history-values-mini {
    padding: 18px;
    border-radius: 28px;
  }

  .history-value-mini {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    min-height: auto;
    padding: 14px;
  }

  .history-value-mini img {
    width: 58px;
    height: 58px;
  }

  .history-value-mini h3 {
    font-size: 18px;
    line-height: 1.15;
    word-break: normal;
    overflow-wrap: normal;
    hyphens: none;
  }

  .history-value-mini p {
    font-size: 14px;
    line-height: 1.35;
    word-break: normal;
    overflow-wrap: normal;
  }
}
