/*
 * luget.astronomy.az — плоская тёмная тема HAC (этап 1b).
 * Токены: фон #1e1e1e, акцент #254568, active/focus #8fb4e3, Manrope 400/500/700.
 * Титул бренда (шапка + hero): Oswald 200/600/700, двухвесовой КАПС, одна строка.
 * Без плиток, рамок и видимых скроллбаров; слои разделены цветом и отступами.
 */

:root {
  --bg: #1e1e1e;
  --surface: #28292a;
  --surface-2: #303132;
  --text: #fff;
  --muted: rgba(255, 255, 255, .72);
  --faint: rgba(255, 255, 255, .45);
  --accent: #254568;
  --accent-bright: #8fb4e3;
  --link: #a1b0c1;
  --radius: 8px;
}

* { box-sizing: border-box; scrollbar-width: none; }
*::-webkit-scrollbar { display: none; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--text); }

:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

.icon { width: 20px; height: 20px; flex: none; }

mark {
  background: rgba(143, 180, 227, .28);
  color: var(--text);
  border-radius: 3px;
  padding: 0 1px;
}

/* Шапка */
.site-header {
  max-width: 760px;
  margin: 0 auto;
  padding: 16px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  row-gap: 4px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  min-width: 0;
}
/* Титул бренда: двухвесовой КАПС (Oswald 600 «астрономия» / 200 «словарь»),
   ВСЕГДА в одну строку на всех трёх языках. Размеры подобраны по фактическим
   advance-width Oswald v57 (600/200): самый длинный титул — RU 12.62em.
   hero clamp(1.1rem, 5.2vw, 2.4rem) → 17.6px при 320px = 222px при доступных 288px;
   brand clamp(0.9rem, 3.4vw, 1.3rem) → 14.4px = 182px при доступных 258px (288 − иконка 22 − gap 8).
   Запас покрывает и FOUT-фолбэк Manrope (RU 15.87em → 279px / 229px).
   При нехватке места ниже титула переносится lang-switcher (flex-wrap шапки), не титул. */
.brand-title,
.hero-title {
  font-family: 'Oswald', 'Manrope', system-ui, sans-serif;
  text-transform: uppercase;
  white-space: nowrap;
  display: inline-flex;
  align-items: baseline;
  gap: .3em;
  letter-spacing: 0;
  line-height: 1.15;
}
.title-strong { font-weight: 600; }
.title-light { font-weight: 200; }
.brand-title { font-size: clamp(0.9rem, 3.4vw, 1.3rem); }
.hero-title { font-size: clamp(1.1rem, 5.2vw, 2.4rem); }
.brand-icon { color: var(--accent-bright); width: 22px; height: 22px; }
.lang-switcher { display: inline-flex; align-items: center; gap: 2px; }
.lang-icon { width: 18px; height: 18px; color: var(--faint); margin-right: 4px; }
.lang-link {
  padding: 8px 8px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  letter-spacing: .04em;
  color: var(--faint);
}
.lang-link:hover { color: var(--text); background: var(--surface); }
.lang-link.current { color: var(--accent-bright); font-weight: 700; }

/* Липкий поиск */
.search-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding: 8px 16px 12px;
}
.search-wrap { position: relative; max-width: 760px; margin: 0 auto; }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  translate: 0 -50%;
  color: var(--faint);
  pointer-events: none;
}
#search-input {
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border: 0;
  border-radius: var(--radius);
  padding: 14px 48px;
  font: inherit;
  font-size: 1rem;
}
#search-input::placeholder { color: var(--faint); }
#search-input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-bright); }
#search-input::-webkit-search-cancel-button,
#search-input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }
.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  translate: 0 -50%;
  display: inline-flex;
  padding: 8px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--faint);
  cursor: pointer;
}
.search-clear:hover { color: var(--text); background: var(--surface-2); }

/* Панель результатов */
.search-results { max-width: 760px; margin: 0 auto; padding: 0 16px 8px; }
.results-count { margin: 4px 4px 8px; color: var(--muted); font-size: .875rem; }
.results-limit { color: var(--faint); }
.search-status { margin: 8px 4px; color: var(--muted); }
.no-results { padding: 20px 4px; }
.no-results-title { margin: 0 0 6px; font-weight: 700; }
.no-results-hint { margin: 0; color: var(--muted); font-size: .9rem; max-width: 60ch; }

/* Строки терминов (поиск и указатель) */
.rows { display: flex; flex-direction: column; }
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 12px;
  border-radius: var(--radius);
  color: var(--text);
  transition: background .12s ease;
}
.row:hover, .row.active { background: var(--surface); color: var(--text); }
.row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-primary { font-weight: 500; font-size: 1.02rem; color: var(--text); overflow-wrap: anywhere; }
.row-secondary { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.row-secondary .dot { color: var(--faint); }
.row-side { display: inline-flex; align-items: center; gap: 6px; }
.badge {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--accent-bright);
  background: var(--surface-2);
  padding: 3px 6px;
  border-radius: 4px;
}
.row-chevron { color: var(--faint); width: 18px; height: 18px; }

/* Основная область */
.page { max-width: 760px; margin: 0 auto; padding: 8px 16px 40px; }
.hero h1 {
  margin: 12px 0 4px;
  line-height: 1.2;
}
/* Размер и веса hero-титула задаёт .hero-title / .title-strong / .title-light (шапка). */
.tagline { margin: 0 0 14px; color: var(--accent-bright); font-weight: 500; }
.intro { margin: 0 0 20px; color: var(--muted); max-width: 60ch; }
.intro-link { margin: 0; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  font-size: .95rem;
  padding: 10px 16px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
}
.btn:hover { color: #fff; opacity: .9; }
.btn .icon { width: 18px; height: 18px; }
.section-title { margin: 28px 0 10px; font-size: 1rem; font-weight: 700; color: var(--muted); }

/* Алфавитная панель: плоские буквы; перенос строк на всех ширинах —
   все буквы видны сразу, без горизонтального скролла. */
.alphabet { display: flex; flex-wrap: wrap; gap: 4px; overflow-x: visible; padding: 4px 0 8px; }
.letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 40px;
  padding: 0 6px;
  border-radius: var(--radius);
  color: var(--link);
  font-weight: 500;
  flex: none;
}
.letter:hover { background: var(--surface); color: var(--text); }
.letter.current { color: var(--accent-bright); font-weight: 700; background: var(--surface-2); }
.letter.empty { color: var(--faint); }

/* Указатель */
.browse-page h1 { margin: 12px 0 4px; font-size: clamp(1.4rem, 4vw, 1.9rem); line-height: 1.25; }
.browse-sub { margin: 0 0 12px; color: var(--muted); font-size: .9rem; }
.empty-letter { color: var(--muted); padding: 20px 4px; }

/* Страница термина */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 20px;
  font-size: .9rem;
}
.back-link .icon { width: 18px; height: 18px; }
.term-block { margin: 0 0 22px; }
.term-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.term-label .icon { width: 16px; height: 16px; }
.term-value {
  margin: 0;
  font-size: clamp(1.5rem, 4.5vw, 2.1rem);
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.term-value-secondary { font-size: clamp(1.15rem, 3vw, 1.5rem); font-weight: 500; color: var(--muted); }
.term-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  align-items: center;
  margin-top: 26px;
  color: var(--muted);
  font-size: .875rem;
}
.meta-item { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.meta-item .icon { width: 17px; height: 17px; color: var(--faint); }
.letter-chip {
  background: var(--surface-2);
  color: var(--link);
  padding: 4px 9px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
}
.letter-chip:hover { color: var(--accent-bright); }
.letter-chip-plain { color: var(--faint); }

/* 404 */
.not-found h1 { margin: 16px 0 8px; font-size: clamp(1.4rem, 4vw, 1.9rem); }
.not-found p { color: var(--muted); }

/* Подвал */
.site-footer { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; }
.site-footer a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: .85rem;
}
.site-footer a:hover { color: var(--link); }
.footer-icon { width: 17px; height: 17px; }

@media (min-width: 640px) {
  .site-header { padding: 20px 24px 10px; }
  .search-bar { padding: 8px 24px 12px; }
  .search-results { padding: 0 24px 8px; }
  .page { padding: 8px 24px 48px; }
  .site-footer { padding: 24px 24px 48px; }
  .row { padding: 14px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* ===========================================================================
   Обратная связь (тест-фаза, SPA) — additive. Кнопка на термине + slide-in панель.
   Плоский стиль HAC: без плиток/рамок/видимых скроллбаров; слои — цветом и отступами.
   Мобильный паттерн: slide-in справа (на узких экранах — во всю ширину).
   =========================================================================== */
.term-actions { margin-top: 28px; }
.feedback-open { background: var(--surface-2); color: var(--accent-bright); }
.feedback-open:hover { background: var(--accent); color: #fff; opacity: 1; }
.feedback-open .icon { width: 18px; height: 18px; }

body.feedback-lock { overflow: hidden; }

.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: flex-end;
}
.feedback-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
  opacity: 0;
  transition: opacity .22s ease;
}
.feedback-overlay.open .feedback-backdrop { opacity: 1; }

.feedback-panel {
  position: relative;
  width: min(440px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--surface);
  padding: 20px 20px 32px;
  transform: translateX(100%);
  transition: transform .22s ease;
  outline: none;
}
.feedback-overlay.open .feedback-panel { transform: translateX(0); }

.feedback-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.feedback-head h2 { margin: 0; font-size: 1.15rem; font-weight: 700; line-height: 1.3; }
.feedback-close {
  display: inline-flex;
  padding: 8px;
  background: none;
  border: 0;
  border-radius: 6px;
  color: var(--faint);
  cursor: pointer;
}
.feedback-close:hover { color: var(--text); background: var(--surface-2); }
.feedback-intro { margin: 0 0 18px; color: var(--muted); font-size: .9rem; }

.feedback-field { margin-bottom: 16px; }
.feedback-label {
  display: block;
  margin-bottom: 6px;
  color: var(--faint);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
}

/* Сегментированный выбор (тип сообщения / язык поля): плоские сегменты, без рамок. */
.segmented { display: flex; flex-wrap: wrap; gap: 4px; }
.seg {
  flex: 1 1 auto;
  min-width: 64px;
  padding: 9px 10px;
  background: var(--surface-2);
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font: inherit;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--accent); color: #fff; font-weight: 700; }

.feedback-input {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 0;
  border-radius: var(--radius);
  padding: 11px 12px;
  font: inherit;
  font-size: .95rem;
  line-height: 1.45;
  resize: vertical;
}
.feedback-input::placeholder { color: var(--faint); }
.feedback-input:focus { outline: none; box-shadow: 0 0 0 2px var(--accent-bright); }
.feedback-input[readonly] { color: var(--muted); cursor: default; resize: none; }
.feedback-input[readonly]:focus { box-shadow: none; }

/* Honeypot: визуально скрыт (не display:none — боты могут проверять), вне потока. */
.feedback-hp {
  position: absolute;
  left: -9999px;
  top: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.feedback-error { margin: 0 0 14px; color: #ffb4a1; font-size: .875rem; }
.feedback-actions { display: flex; align-items: center; gap: 12px; margin-top: 20px; }
.feedback-submit .icon { width: 18px; height: 18px; }
.feedback-submit:disabled { opacity: .6; cursor: default; }
.feedback-cancel {
  background: none;
  border: 0;
  padding: 10px 8px;
  color: var(--muted);
  font: inherit;
  font-size: .9rem;
  cursor: pointer;
  border-radius: 6px;
}
.feedback-cancel:hover { color: var(--text); background: var(--surface-2); }

.feedback-success {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 48px 16px;
  text-align: center;
}
.feedback-success-icon { width: 40px; height: 40px; color: var(--accent-bright); }
.feedback-success p { margin: 0; color: var(--text); font-size: 1rem; font-weight: 500; }