/* -----------------------------------------------------
   КОЛІРНІ ПАЛІТРИ ЗА РОЗДІЛАМИ (CSS-змінні)
   ----------------------------------------------------- */
:root {
  /* Базова схема (за замовчуванням) */
  --theme-primary: #0f172a; /* Основний темний */
  --theme-accent: #facc15; /* Акцентний жовтий */
  --theme-accent-hover: #eab308; /* Акцентний при наведенні */
  --theme-bg-light: #e2e8f0; /* Світло-сірий фон секцій */
  --theme-card-bg: #ffffff; /* Білий фон карток */
  --theme-text: #111827; /* Колір тексту */
}
/* 1. Вступ, основи (tractor-basics) — Синьо-жовта класика */
.section-basics {
  --theme-primary: #0f172a;
  --theme-accent: #facc15;
  --theme-accent-hover: #eab308;
}
/* 2. Двигун (engine) — Технічний помаранчевий/терракотовий */
.section-engine {
  --theme-primary: #1e1b4b;
  --theme-accent: #f97316;
  --theme-accent-hover: #ea580c;
}
/* 3. Трансмісія (transmission) — Глибокий синій та бірюза */
.section-transmission {
  --theme-primary: #0f172a;
  --theme-accent: #06b6d4;
  --theme-accent-hover: #0891b2;
}
/* 4. Ходова частина (chassis) — Землистий зелений (агро-стиль) */
.section-chassis {
  --theme-primary: #14532d;
  --theme-accent: #22c55e;
  --theme-accent-hover: #16a34a;
}
/* 5. Механізми керування (controls) — Сталевий сірий та червоний акцент */
.section-controls {
  --theme-primary: #1e293b;
  --theme-accent: #ef4444;
  --theme-accent-hover: #dc2626;
}
/* 6. Робоче обладнання (implements) — Насичений фіолетовий */
.section-implements {
  --theme-primary: #2e1065;
  --theme-accent: #a855f7;
  --theme-accent-hover: #9333ea;
}
/* 7. Допоміжне обладнання (auxiliary-equipment) — Сучасний чирок (teal) */
.section-auxiliary {
  --theme-primary: #115e59;
  --theme-accent: #14b8a6;
  --theme-accent-hover: #0d9488;
}
/* 8. Електрообладнання (electrical) — Електричний синій та яскравий жовтий */
.section-electrical {
  --theme-primary: #030712;
  --theme-accent: #3b82f6;
  --theme-accent-hover: #2563eb;
}
/* -----------------------------------------------------
   СТИЛІЗАЦІЯ КОМПОНЕНТІВ СТОРІНОК ТЕМ
   ----------------------------------------------------- */
/* Hero-блок теми */
.page-hero {
  min-height: 65vh;
  position: relative;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.65), rgba(15, 23, 42, 0.65)),
    url("../images/tractor-hero.jpg");
  background-color: var(--theme-primary);
  background-size: cover;
  background-position: center;
  padding: 80px 20px;
  text-align: center;
  color: #ffffff;
}
.engine-hero {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.55)),
    url("../images/engine-hero.jpg");
  background-size: cover;
  background-position: center;
}
.transmission-hero {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.55)),
    url("../images/transmission-hero.jpg");
  background-size: cover;
  background-position: center;
}
.chassis-hero {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.55)),
    url("../images/chassis-hero.jpg");
  background-size: cover;
  background-position: center;
}
.guschassis-hero {
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.55), rgba(15, 23, 42, 0.55)),
    url("../images/guschassis-hero.jpg");
  background-size: cover;
  background-position: center;
}
/* Затемнення через лінійний градієнт (0.60–0.75) */
.page-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}
.page-hero-content {
  position: relative;
  z-index: 2;
  max-width: 900px;
  margin: 0 auto;
}
.page-hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: #ffffff;
}
.page-hero p {
  font-size: 1.2rem;
  font-weight: 400;
  line-height: 1.6;
  color: #e2e8f0;
}
/* Номер та назва розділу всередині Hero */
.page-hero-section-title {
  display: inline-block;
  color: var(
    --theme-accent
  ); /* Автоматично підлаштовується під колір розділу */
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
/* =========================================
   HERO NAVIGATION
   ========================================= */

.bt-hero-nav-top {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 45px;
  flex-wrap: wrap;
}

.bt-hero-nav-bottom {
  display: flex;
  gap: 18px;
  margin-top: 28px;
  align-items: stretch;
}

.bt-hero-nav-bottom .bt-hero-link {
  flex: 1;
}

.bt-hero-link {
  display: flex;
  align-items: center;
  gap: 16px;
  text-decoration: none;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  transition: 0.25s;
  backdrop-filter: blur(8px);
}

.bt-hero-link:hover {
  background: rgba(255, 255, 255, 0.16);
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.35);
}

.bt-hero-link-small {
  justify-content: center;
  width: 250px;
  padding: 16px 20px;
}

.bt-hero-link-wide {
  padding: 18px 22px;
}
.bt-hero-link-next {
  text-align: right;
  justify-content: flex-end;
}
.bt-hero-link strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 6px;
}

.bt-hero-link span {
  display: block;
  opacity: 0.85;
  font-size: 0.92rem;
}
/* Головний банер-інфографіка теми */
.bt-main-banner {
  width: 100%;
  margin-bottom: 40px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  background-color: var(--theme-card-bg);
}
.bt-main-banner img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}
/* Контейнер для контенту */
.bt-content-section {
  background-color: var(--theme-bg-light);
  padding: 20px 20px;
}
.bt-theme-container {
  max-width: 1200px;
  margin: 0 auto;
  color: var(--theme-text);
}
.bt-theme-container p {
  font-size: 1.1rem;
  line-height: 1.7;
  margin-bottom: 20px;
  text-align: justify;
}
.bt-theme-container h1 {
  text-align: center;
  font-size: 2.2rem;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 24px;
  color: var(--theme-primary);
}
.bt-theme-container h2 {
  text-align: center;
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 24px;
  color: var(--theme-primary);
}
/* Контейнер сітки карток */
.bt-cards-grid {
  display: grid;
  /* Автоматично підлаштовує колонки: якщо карток 2 — розтягне на 2, якщо 3 — на 3, але не більше */
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}
/* Компонент картки з STEM-ефектами */
.bt-card {
  background: var(--theme-card-bg);
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  border-left: 4px solid var(--theme-accent);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}
.bt-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 20px rgba(0, 0, 0, 0.1);
}
.bt-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-top: 12px;
  margin-bottom: 10px;
  color: var(--theme-primary);
}
.bt-card p {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0;
}
/* Списки */
.bt-theme-list {
  list-style: none;
  padding: 0;
  margin-bottom: 40px;
}
.bt-theme-list li {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 12px;
  padding-left: 20px;
  border-left: 3px solid var(--theme-accent);
}
/* Адаптивна таблиця */
/* Переконуємось, що обгортка жорстко тримає межі екрана */
.bt-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  display: block;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 30px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  background: var(--theme-card-bg);
  border-radius: 12px;
}
/* Сама таблиця */
.bt-table {
  width: 100%;
  border-collapse: collapse;
  /* Якщо min-width заважає на 631px, ми скидаємо його для мобільних */
  min-width: 100% !important;
  table-layout: fixed; /* Жорстко фіксує ширину колонок, не даючи їм розпирати екран */
}
/* Задаємо пропорції колонок, щоб остання мала найбільше місця, але не безкінечно */
.bt-table th:nth-child(1),
.bt-table td:nth-child(1) {
  width: 20%;
}
.bt-table th:nth-child(2),
.bt-table td:nth-child(2) {
  width: 30%;
}
.bt-table th:nth-child(3),
.bt-table td:nth-child(3) {
  width: 50%;
}
/* Примусове перенесення слів */
.bt-table th,
.bt-table td {
  padding: 16px;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  white-space: normal; /* Дозволяє тексту переноситися на нові рядки */
  border-bottom: 1px solid var(--theme-bg-light);
}
.bt-table thead tr {
  background-color: var(--theme-primary);
  color: #ffffff;
}
.bt-table tbody tr:nth-child(even) {
  background: #f8fafc;
}
/* Контейнер для зображення всередині картки */
.bt-card-img-container {
  width: 100%;
  height: auto; /* прибираємо фіксовану висоту, щоб нічого не різало */
  background-color: #ffffff; /* якщо є мінімальні поля, вони зливаються з фоном */
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible; /* дозволяємо картинці відображатися повністю */
  margin-bottom: 10px;
}
/* Картинка масштабується ідеально під будь-який екран */
.bt-card-img-container img {
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: contain; /* гарантує, що малюнок впишеться повністю без обрізань */
  display: block;
}
/* Адаптивне зображення */
.bt-responsive-img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Картинка заповнює область без спотворення пропорцій */
  transition: transform 0.5s ease;
}
/* Для схем (наприклад, SVG остова), де важливо бачити весь малюнок повністю */
.bt-card-img-container.text-center .bt-responsive-img {
  object-fit: contain;
  padding: 10px;
}
/* Ефект наближення картинки при наведенні на картку */
.bt-card:hover .bt-responsive-img {
  transform: scale(1.04);
}
/* Додатковий утилітарний клас для центрування */
.text-center {
  text-align: center;
}
/* Анкета реєстрації перед тестом */
.quiz-registration-box {
  margin-bottom: 35px;
  padding-bottom: 25px;
  border-bottom: 2px solid var(--theme-bg-light);
}
.quiz-reg-title {
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--theme-primary);
  font-size: 1.2rem;
}
.quiz-reg-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}
.quiz-reg-group label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
  font-size: 0.9rem;
  color: #475569;
}
.quiz-reg-group input {
  width: 100%;
  padding: 10px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.95rem;
  box-sizing: border-box;
}
/* Фінальний звіт та картка результатів */
.quiz-result-card {
  display: none;
  margin-top: 40px;
  padding: 30px;
  background: #f8fafc;
  border: 2px solid var(--theme-primary);
  border-radius: 12px;
  text-align: center;
}
.quiz-student-report {
  display: none;
  margin-bottom: 25px;
  padding: 15px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  text-align: left;
  font-size: 1rem;
  color: #334155;
}
.quiz-student-report.active {
  display: block !important; /* Показує блок, коли тест завершено */
}
.quiz-student-report p {
  margin: 5px 0;
}
.quiz-student-report span {
  color: #0f172a;
  font-weight: 600;
}
.quiz-result-title {
  margin-top: 0;
  color: var(--theme-primary);
  font-size: 1.4rem;
}
.quiz-result-stats {
  font-size: 1.1rem;
  color: #334155;
}
.quiz-score-container {
  margin: 20px 0;
}
.quiz-score-label {
  font-size: 1rem;
  color: #64748b;
  display: block;
  text-transform: uppercase;
  letter-spacing: 1px;
}
#res-score {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1;
}
.quiz-score-max {
  font-size: 1.5rem;
  font-weight: bold;
  color: #64748b;
}
.quiz-verdict-text {
  font-size: 1.05rem;
  color: #1e293b;
  font-weight: 500;
  max-width: 500px;
  margin: 0 auto;
}
.quiz-retry-btn {
  width: auto !important;
  margin-top: 25px;
  padding: 12px 30px;
  background: var(--theme-primary);
  color: #ffffff;
  font-weight: bold;
  border-color: var(--theme-primary);
  display: inline-block;
}
/* Стилізація кнопок тесту */
.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 15px;
}
.quiz-btn {
  width: 100%;
  text-align: left;
  padding: 14px 18px;
  background-color: #f8fafc; /* Світлий нейтральний фон */
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: "Montserrat", sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  transition: all 0.25s ease;
}
.quiz-item {
  margin-top: 30px;
  border-top: 1px dashed var(--theme-bg-light);
  padding-top: 25px;
}
/* Ефект наведення на кнопку (поки на запитання не відповіли) */
.quiz-item:not(.answered) .quiz-btn:hover {
  background-color: #f1f5f9;
  border-color: var(--theme-accent); /* Жовта рамка при наведенні */
  transform: translateX(4px); /* Легкий зсув вправо для інтерактивності */
}
.quiz-question {
  font-size: 1.1rem;
  color: #1e293b;
  line-height: 1.5;
}
/* Додаткове оформлення картки тесту, інтегрованої в загальну секцію */
.bt-quiz-card {
  margin-top: 25px;
  padding: 24px;
  border: 1px solid var(--theme-bg-light); /* Легка рамка, щоб виділити інтерактивний блок */
}
/* Спеціальна сітка для відео та медіа-матеріалів */
.bt-media-grid {
  display: grid;
  /* Дозволяє колонкам адаптуватися під контент, обмежуючи макс. кількість до 2 */
  grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
  justify-content: center; /* Центрує колонки, якщо їх менше, ніж заповнений ряд */
}
/* Якщо картка в медіатеці взагалі одна, задаємо їй оптимальну ширину на ПК */
.bt-media-grid:has(.bt-card:only-child) {
  grid-template-columns: minmax(300px, 600px);
}
/* Адаптивний контейнер для відео */
.bt-video-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* Співвідношення сторін 16:9 (9 / 16 * 100) */
  height: 0;
  overflow: hidden;
  width: 100%;
  border-radius: 8px; /* Легке заокруглення кутів для краси */
  margin-top: 15px;
}
.bt-video-wrapper iframe,
.bt-video-wrapper object,
.bt-video-wrapper embed,
.bt-video-wrapper video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.bt-takt-card {
  display: flex;
  gap: 30px;
  align-items: center;
}
.bt-takt-media {
  flex: 1;
}
.bt-takt-content {
  flex: 1;
}
.bt-takt-content ul {
  margin-left: 20px;
}
.bt-takt-media video {
  width: 100%;
  border-radius: 12px;
}

/* Адаптація для мобільних екранів */
@media (max-width: 768px) {
  .page-hero {
    padding: 60px 16px;
    min-height: 35vh;
  }
  .page-hero h1 {
    font-size: 1.8rem;
  }
  .page-hero p {
    font-size: 1rem;
  }
  .page-hero-section-title {
    font-size: 0.85rem;
    margin-bottom: 8px;
  }
  .bt-main-banner {
    margin-bottom: 20px;
  }
  .bt-content-section {
    padding: 20px 16px;
  }
  .bt-theme-container h2,
  .bt-theme-container h3,
  .bt-theme-container > p {
    padding-left: 16px;
    padding-right: 16px;
  }
  .bt-theme-container h2 {
    font-size: 1.5rem;
  }
  .bt-cards-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .bt-card {
    padding: 14px;
  }
  .bt-card-img-container {
    height: 200px; /* Трохи більша висота на мобільних телефонах */
  }
  .bt-table-wrapper {
    margin-bottom: 15px;
  }
  .bt-table {
    font-size: 0.85rem;
  }
  .bt-table th,
  .bt-table td {
    padding: 8px 6px;
  }
  .quiz-question {
    font-size: 1rem;
  }
  .quiz-btn {
    font-size: 0.9rem;
    padding: 12px 14px;
  }
  /* Корекція внутрішніх відступів картки тесту на мобільних пристроях */
  .bt-quiz-card {
    padding: 16px;
    margin-top: 20px;
  }
  .bt-media-grid {
    grid-template-columns: 1fr; /* Перебудова в один стовпчик на смартфонах */
    gap: 16px;
  }
  .bt-takt-card {
    flex-direction: column;
  }

  /* =========================================
   HERO NAVIGATION MOBILE
   ========================================= */

  .bt-hero-nav-top {
    flex-direction: column;

    gap: 14px;
  }

  .bt-hero-nav-bottom {
    flex-direction: column;

    gap: 14px;
  }

  .bt-hero-link-small {
    width: 100%;
  }

  .bt-hero-link-next {
    text-align: left;

    justify-content: flex-start;
  }
}
/* Центрування сьомої (останньої) картки в сітці на ПК */
@media (min-width: 1216px) {
  .bt-cards-grid .bt-card:nth-child(7):last-child {
    grid-column: 2;
  }
}
