/* ============================================================
   Азбука Морзе — Основные стили
   Тема: «Телеграфная лента» — тёмный фон, золотой акцент
   ============================================================ */

/* --- Сброс и базовые настройки --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  background-color: #12121a;
  color: #e8e8ee;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img, svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* --- Контейнер --- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  width: 100%;
}

/* ============================================================
   ШАПКА (HEADER)
   ============================================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: linear-gradient(135deg, #0d0d14 0%, #1a1a2a 100%);
  border-bottom: 2px solid #c8a84e;
  box-shadow: 0 2px 20px rgba(200, 168, 78, 0.15);
  padding: 12px 0;
}

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

.header__title-group {
  flex-shrink: 0;
}

.header__title {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  font-size: 1.5rem;
  font-weight: 700;
  color: #c8a84e;
  text-transform: uppercase;
  letter-spacing: 3px;
  text-shadow: 0 0 10px rgba(200, 168, 78, 0.3);
}

.header__subtitle {
  font-size: 0.75rem;
  color: #8888a0;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* --- Навигация --- */
.nav__list {
  display: flex;
  gap: 8px;
}

.nav__link {
  display: inline-block;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #b0b0c8;
  border: 1px solid transparent;
  border-radius: 4px;
  transition: all 0.3s ease;
  letter-spacing: 0.5px;
}

.nav__link:hover,
.nav__link:focus {
  color: #c8a84e;
  border-color: #c8a84e;
  background: rgba(200, 168, 78, 0.08);
}

/* --- Бургер-меню --- */
.burger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}

.burger__line {
  display: block;
  width: 100%;
  height: 2px;
  background: #c8a84e;
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* ============================================================
   РАЗДЕЛЫ (SECTIONS)
   ============================================================ */
main {
  flex: 1;
  padding-top: 80px;
}

.section {
  padding: 60px 0;
  border-bottom: 1px solid rgba(200, 168, 78, 0.1);
}

.section:last-of-type {
  border-bottom: none;
}

.section:nth-child(even) {
  background: rgba(26, 26, 42, 0.5);
}

.section__title {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  font-size: 1.6rem;
  color: #c8a84e;
  margin-bottom: 30px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(200, 168, 78, 0.25);
  letter-spacing: 1px;
  text-shadow: 0 0 8px rgba(200, 168, 78, 0.15);
}

.section__subtitle {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  font-size: 1.15rem;
  color: #d4b85e;
  margin: 30px 0 15px;
  letter-spacing: 1px;
}

/* ============================================================
   РАЗДЕЛ «ИСТОРИЯ»
   ============================================================ */
.history {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 30px;
  align-items: start;
}

.history__portrait {
  display: flex;
  justify-content: center;
}

.history__image {
  width: 200px;
  height: 240px;
  border-radius: 8px;
  border: 2px solid rgba(200, 168, 78, 0.3);
}

.history__content p {
  margin-bottom: 15px;
  font-size: 1rem;
  line-height: 1.7;
}

.history__content p strong {
  color: #c8a84e;
}

.history__content p em {
  color: #d4b85e;
}

/* --- Таймлайн --- */
.timeline {
  margin-top: 25px;
  padding: 20px;
  background: rgba(26, 26, 42, 0.7);
  border-radius: 8px;
  border-left: 3px solid #c8a84e;
}

.timeline__item {
  display: flex;
  gap: 15px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(200, 168, 78, 0.1);
}

.timeline__item:last-child {
  border-bottom: none;
}

.timeline__year {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  font-weight: 700;
  color: #c8a84e;
  flex-shrink: 0;
  width: 55px;
}

.timeline__desc {
  color: #c0c0d0;
}

/* ============================================================
   ТАБЛИЦА АЛФАВИТА
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  margin-bottom: 20px;
}

.morse-table {
  width: 100%;
  max-width: 500px;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: rgba(26, 26, 42, 0.6);
  border-radius: 6px;
  overflow: hidden;
}

.morse-table thead {
  background: linear-gradient(135deg, #1a1a2e, #2a2a3e);
}

.morse-table th {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  font-weight: 600;
  color: #c8a84e;
  text-align: left;
  padding: 12px 18px;
  border-bottom: 2px solid #c8a84e;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 0.85rem;
}

.morse-table td {
  padding: 8px 18px;
  border-bottom: 1px solid rgba(200, 168, 78, 0.08);
  color: #d0d0e0;
}

.morse-table tbody tr {
  transition: background 0.2s ease;
}

.morse-table tbody tr:hover {
  background: rgba(200, 168, 78, 0.06);
}

.morse-table tbody tr:last-child td {
  border-bottom: none;
}

/* --- Код Морзе в таблице — точки (·) и тире (−) --- */
.morse-code {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: #e8d48b;
}

/* Точка — круглый маркер */
.morse-code .dot,
.morse-code::first-letter? /* не используем псевдо — явно размечаем в HTML? */
/* Используем стилизацию через содержимое:
   Точка: · — короткий сигнал,
   Тире: − — длинный сигнал.
   Они уже визуально различимы, но добавим цветовые акценты.
*/

/* Вариант: подсветка точек и тире через span, если нужно.
   Но поскольку символы · и − уже визуально разные, 
   выделим весь код цветом и размером. */

/* Дополнительно: каждая буква с кодом — строка */
.morse-table td:first-child {
  font-weight: 600;
  color: #e0e0f0;
  font-size: 1.05rem;
}

/* ============================================================
   РАЗДЕЛ «ПРАВИЛА» — СЕТКА КАРТОЧЕК
   ============================================================ */
.rules {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.rule-card {
  background: rgba(26, 26, 42, 0.6);
  border: 1px solid rgba(200, 168, 78, 0.15);
  border-radius: 8px;
  padding: 24px;
  transition: all 0.3s ease;
}

.rule-card:hover {
  border-color: rgba(200, 168, 78, 0.4);
  box-shadow: 0 4px 20px rgba(200, 168, 78, 0.08);
  transform: translateY(-2px);
}

.rule-card__title {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  font-size: 1.05rem;
  color: #c8a84e;
  margin-bottom: 14px;
  letter-spacing: 0.5px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(200, 168, 78, 0.15);
}

.rule-card__list li {
  padding: 6px 0;
  padding-left: 18px;
  position: relative;
  font-size: 0.95rem;
  color: #c8c8e0;
  line-height: 1.5;
}

.rule-card__list li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: #c8a84e;
  font-weight: 700;
}

.rule-card__label {
  color: #d4b85e;
  font-weight: 500;
}

.rule-card__list li strong {
  color: #c8a84e;
}

/* ============================================================
   ПОДВАЛ (FOOTER)
   ============================================================ */
.footer {
  background: linear-gradient(135deg, #0d0d14 0%, #1a1a2a 100%);
  border-top: 2px solid rgba(200, 168, 78, 0.2);
  padding: 24px 0;
  margin-top: auto;
}

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

.footer__copy {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  color: #c8a84e;
  font-size: 0.85rem;
  letter-spacing: 1px;
}

.footer__info {
  color: #707088;
  font-size: 0.8rem;
}

/* ============================================================
   СКРОЛЛБАР (стилизация)
   ============================================================ */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #1a1a2a;
}

::-webkit-scrollbar-thumb {
  background: #3a3a5a;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #c8a84e;
}

/* ============================================================
   АДАПТИВНОСТЬ — ПЛАНШЕТ (768–1023px)
   ============================================================ */
@media (max-width: 1023px) {
  html {
    font-size: 15px;
  }

  .header {
    padding: 10px 0;
  }

  .header__title {
    font-size: 1.3rem;
  }

  .section {
    padding: 45px 0;
  }

  .section__title {
    font-size: 1.35rem;
  }

  .history {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .history__portrait {
    order: -1;
  }

  .history__image {
    width: 160px;
    height: 192px;
  }

  .rules {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .morse-table {
    max-width: 100%;
  }

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

/* ============================================================
   АДАПТИВНОСТЬ — МОБИЛЬНЫЕ (<768px)
   ============================================================ */
@media (max-width: 767px) {
  html {
    font-size: 14px;
  }

  .container {
    padding: 0 14px;
  }

  .header {
    padding: 10px 0;
  }

  .header__title {
    font-size: 1.1rem;
    letter-spacing: 2px;
  }

  .header__subtitle {
    font-size: 0.65rem;
  }

  /* --- Бургер-меню на мобильных --- */
  .burger {
    display: flex;
  }

  .nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: rgba(13, 13, 20, 0.98);
    border-bottom: 2px solid #c8a84e;
    padding: 16px;
    transform: translateY(-120%);
    opacity: 0;
    transition: all 0.35s ease;
    pointer-events: none;
  }

  .nav--open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav__list {
    flex-direction: column;
    gap: 4px;
  }

  .nav__link {
    display: block;
    padding: 12px 16px;
    text-align: center;
    font-size: 1rem;
  }

  /* Бургер анимация при открытии */
  .burger--active .burger__line:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
  }

  .burger--active .burger__line:nth-child(2) {
    opacity: 0;
  }

  .burger--active .burger__line:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
  }

  main {
    padding-top: 60px;
  }

  .section {
    padding: 35px 0;
  }

  .section__title {
    font-size: 1.2rem;
    margin-bottom: 20px;
  }

  .section__subtitle {
    font-size: 1rem;
  }

  .history__image {
    width: 140px;
    height: 168px;
  }

  .history__content p {
    font-size: 0.95rem;
  }

  .timeline {
    padding: 14px;
  }

  .timeline__item {
    flex-direction: column;
    gap: 4px;
  }

  .timeline__year {
    width: auto;
  }

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

  .rule-card {
    padding: 18px;
  }

  .morse-table {
    font-size: 0.88rem;
  }

  .morse-table th,
  .morse-table td {
    padding: 8px 12px;
  }

  .morse-code {
    font-size: 1rem;
    letter-spacing: 3px;
  }

  .footer {
    padding: 18px 0;
  }

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

/* ============================================================
   АДАПТИВНОСТЬ — ДЕСКТОП (≥1024px) — базовые стили выше
   ============================================================ */
@media (min-width: 1024px) {
  .container {
    padding: 0 30px;
  }

  .section {
    padding: 70px 0;
  }

  .section__title {
    font-size: 1.75rem;
  }

  .history {
    grid-template-columns: 220px 1fr;
    gap: 40px;
  }

  .history__image {
    width: 220px;
    height: 264px;
  }
}

/* ============================================================
   ТРЕНАЖЁР ПЕРЕВОДА
   ============================================================ */
.translator__desc {
  font-size: 1rem;
  color: #c0c0d0;
  margin-bottom: 24px;
  line-height: 1.6;
}

.translator__form {
  margin-bottom: 24px;
}

.translator__field {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.translator__input {
  flex: 1;
  min-width: 200px;
  padding: 14px 18px;
  font-size: 1.05rem;
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  background: rgba(26, 26, 42, 0.8);
  border: 1px solid rgba(200, 168, 78, 0.3);
  border-radius: 6px;
  color: #e8e8ee;
  outline: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.translator__input:focus {
  border-color: #c8a84e;
  box-shadow: 0 0 12px rgba(200, 168, 78, 0.15);
}

.translator__input::placeholder {
  color: #606078;
}

.translator__btn {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  color: #12121a;
  background: linear-gradient(135deg, #c8a84e, #d4b85e);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.translator__btn:hover,
.translator__btn:focus {
  background: linear-gradient(135deg, #d4b85e, #e0c86e);
  box-shadow: 0 4px 20px rgba(200, 168, 78, 0.3);
  transform: translateY(-1px);
}

.translator__btn:active {
  transform: translateY(0);
}

.translator__result {
  background: rgba(26, 26, 42, 0.6);
  border: 1px solid rgba(200, 168, 78, 0.15);
  border-radius: 8px;
  padding: 24px;
}

.translator__result-title {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  font-size: 1rem;
  color: #c8a84e;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}

.translator__output {
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: #e8d48b;
  letter-spacing: 3px;
  line-height: 1.8;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  min-height: 50px;
  word-break: break-all;
  margin-bottom: 16px;
  text-shadow: 0 0 6px rgba(232, 212, 139, 0.15);
}

.translator__play-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: 'Courier New', 'Consolas', 'Roboto Mono', monospace;
  color: #c8a84e;
  background: rgba(200, 168, 78, 0.1);
  border: 1px solid rgba(200, 168, 78, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.translator__play-btn:hover,
.translator__play-btn:focus {
  background: rgba(200, 168, 78, 0.2);
  border-color: #c8a84e;
  box-shadow: 0 0 12px rgba(200, 168, 78, 0.15);
}

/* Адаптивность для тренажёра */
@media (max-width: 767px) {
  .translator__field {
    flex-direction: column;
  }

  .translator__input {
    min-width: auto;
    width: 100%;
  }

  .translator__btn {
    width: 100%;
  }

  .translator__output {
    font-size: 1rem;
    letter-spacing: 2px;
  }
}

/* ============================================================
   ВСПОМОГАТЕЛЬНОЕ: ВЫДЕЛЕНИЕ КОДА МОРЗЕ (точки и тире)
   ---
   Точка (·) — короткий сигнал, меньший размер, яркий
   Тире (−) — длинный сигнал, заметно длиннее
   Оба символа уже визуально различны. Добавляем цвет.
   ============================================================ */
.morse-code {
  color: #e8d48b; /* золотистый */
  text-shadow: 0 0 6px rgba(232, 212, 139, 0.2);
}

/* Точки и тире — все символы внутри .morse-code */
.morse-code span {
  display: inline-block;
}

/* Подсветка отдельной точки при использовании span-обёртки */
.morse-code .dot-symbol {
  color: #ffd700;
}

.morse-code .dash-symbol {
  color: #e8b84e;
}

/* ============================================================
   ПЛАВНЫЙ СКРОЛЛ (дополнительно к html { scroll-behavior } )
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
