/* ===== Астрология: учебный сайт ===== */
:root {
  --bg: #0e1220;
  --bg-card: #171d33;
  --bg-card-hover: #1d2440;
  --text: #e8e9f0;
  --text-dim: #a2a7be;
  --accent: #e8b34b;
  --accent-soft: #f3d089;
  --line: #2a3152;
  --link: #8ab4f8;
  --header-bg: rgba(14, 18, 32, .85);
  --radius: 14px;
  --max-w: 980px;
}

/* Светлая тема */
:root[data-theme="light"] {
  --bg: #f6f3ec;
  --bg-card: #ffffff;
  --bg-card-hover: #f1ecdf;
  --text: #2b2d3a;
  --text-dim: #676a7c;
  --accent: #a8760f;
  --accent-soft: #7d5a0c;
  --line: #ddd5c2;
  --link: #1558b0;
  --header-bg: rgba(246, 243, 236, .88);
}

:root[data-theme="light"] body { background-image: none; }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: Georgia, "Times New Roman", serif;
  background: var(--bg);
  background-image:
    radial-gradient(1px 1px at 20% 30%, #fff7 0, transparent 100%),
    radial-gradient(1px 1px at 80% 10%, #fff5 0, transparent 100%),
    radial-gradient(1.5px 1.5px at 60% 70%, #fff4 0, transparent 100%),
    radial-gradient(1px 1px at 35% 85%, #fff6 0, transparent 100%),
    radial-gradient(1px 1px at 90% 55%, #fff5 0, transparent 100%);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  transition: background-color .25s, color .25s;
}

/* ---------- Шапка и навигация ---------- */
header {
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.25rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: .5px;
  white-space: nowrap;
}

nav { display: flex; gap: 4px; flex-wrap: wrap; }

nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .95rem;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

nav a:hover { color: var(--text); background: var(--bg-card); }
nav a.active { color: var(--accent); background: var(--bg-card); }

/* Переключатель темы (кнопка создаётся в main.js) */
#theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 1.05rem;
  line-height: 1.4;
  cursor: pointer;
}

#theme-toggle:hover { background: var(--bg-card-hover); }

/* ---------- Контент ---------- */
main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 20px 80px;
}

h1 {
  font-size: 2rem;
  color: var(--accent-soft);
  margin-bottom: .4em;
  font-weight: normal;
}

h2 {
  font-size: 1.4rem;
  color: var(--accent-soft);
  margin: 1.8em 0 .6em;
  font-weight: normal;
  border-bottom: 1px solid var(--line);
  padding-bottom: .3em;
}

h3 { font-size: 1.1rem; margin: 1.2em 0 .4em; color: var(--text); }

p { margin-bottom: 1em; }
p.lead { font-size: 1.1rem; color: var(--text-dim); margin-bottom: 1.6em; }

a { color: var(--link); }

ul, ol { margin: 0 0 1em 1.4em; }
li { margin-bottom: .4em; }

blockquote {
  border-left: 3px solid var(--accent);
  padding: .5em 1em;
  margin: 1em 0;
  color: var(--text-dim);
  background: var(--bg-card);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ---------- Карточки ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 1.2em 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
}

.card:hover { background: var(--bg-card-hover); }

.card .symbol {
  font-size: 1.9rem;
  color: var(--accent);
  line-height: 1.2;
}

.card h3 { margin: .2em 0 .3em; }
.card p { margin: 0; font-size: .93rem; color: var(--text-dim); }
.card .keywords {
  display: block;
  margin-top: .5em;
  font-size: .85rem;
  color: var(--accent-soft);
  font-style: italic;
}

a.card { text-decoration: none; color: var(--text); display: block; }

/* ---------- Таблицы ---------- */
.table-wrap { overflow-x: auto; margin: 1em 0; }

table {
  border-collapse: collapse;
  width: 100%;
  font-size: .95rem;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}

th, td {
  border: 1px solid var(--line);
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

th { background: var(--bg-card); color: var(--accent-soft); font-weight: 600; }
td .sym { color: var(--accent); font-size: 1.15rem; margin-right: 6px; }

/* ---------- Аудио ---------- */
.audio-item {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 18px;
}

.audio-item h3 { margin-top: 0; }
.audio-item audio { width: 100%; margin-top: 10px; }
.audio-item .meta { font-size: .85rem; color: var(--text-dim); }

/* ---------- Изображения ---------- */
figure {
  margin: 1.5em 0;
  text-align: center;
}

figure img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

figcaption { font-size: .88rem; color: var(--text-dim); margin-top: .6em; }

/* ---------- Шаги обучения ---------- */
.steps { counter-reset: step; list-style: none; margin-left: 0; }

.steps li {
  counter-increment: step;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px 16px 64px;
  margin-bottom: 14px;
  position: relative;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 18px;
  top: 16px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1405;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-family: -apple-system, sans-serif;
}

/* ---------- Подвал ---------- */
footer {
  border-top: 1px solid var(--line);
  color: var(--text-dim);
  font-size: .85rem;
  text-align: center;
  padding: 24px 20px 90px;
}

/* ---------- Чат (заглушка, потом заменится на реальный виджет) ---------- */
#chat-toggle {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #1a1405;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .5);
  z-index: 100;
}

#chat-panel {
  position: fixed;
  right: 22px;
  bottom: 90px;
  width: 300px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .6);
  z-index: 100;
  display: none;
}

#chat-panel.open { display: block; }
#chat-panel h3 { margin-top: 0; color: var(--accent-soft); }
#chat-panel p { font-size: .9rem; color: var(--text-dim); margin-bottom: 0; }

@media (max-width: 600px) {
  h1 { font-size: 1.5rem; }
  .header-inner { padding: 10px 14px; }
}

/* ---------- Натальная карта ---------- */
.natal-form {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px 18px;
  align-items: end;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}
.natal-form label { display: flex; flex-direction: column; gap: 6px; font-size: .9rem; color: var(--text-dim); position: relative; }
.natal-form .opt { font-size: .8rem; }
.natal-form input[type=text], .natal-form input[type=date], .natal-form input[type=time], .natal-form input[type=number] {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
  color-scheme: dark;
}
:root[data-theme="light"] .natal-form input { color-scheme: light; }
.natal-form input:focus { outline: 2px solid var(--accent); outline-offset: 0; }
.natal-form input:disabled { opacity: .45; }
.natal-form .f-unknown { flex-direction: row; align-items: center; gap: 8px; padding-bottom: 10px; cursor: pointer; }
.natal-form .f-place, .natal-form .place-chosen, .natal-form .f-manual,
.natal-form .form-error { grid-column: 1 / -1; }
.place-chosen { margin: -6px 0 0; font-size: .85rem; color: var(--accent-soft); }
.place-chosen:empty, .form-error:empty { display: none; }
.place-results {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
  list-style: none; margin: 4px 0 0; padding: 4px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.place-results li { margin: 0; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text); }
.place-results li span { color: var(--text-dim); font-size: .85rem; }
.place-results li:hover { background: var(--bg-card-hover); }
.place-results li.empty { cursor: default; color: var(--text-dim); }
.f-manual summary { cursor: pointer; color: var(--link); font-size: .9rem; }
.manual-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-top: 10px; }
.hint { font-size: .82rem; color: var(--text-dim); margin: 8px 0 0; }
.form-error { color: #e0674f; margin: 0; }
.btn {
  background: var(--accent); color: #1a1405; border: none; border-radius: 10px;
  padding: 11px 20px; font-size: 1rem; font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer; font-weight: 600;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: normal; }
.btn-ghost:hover { background: var(--bg-card); }
.result-meta { color: var(--text-dim); font-family: -apple-system, "Segoe UI", Roboto, sans-serif; font-size: .92rem; }
.chart-wrap { max-width: 640px; margin: 10px auto 0; }
.natal-wheel { width: 100%; height: auto; display: block; }
.share-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: center; margin-top: 16px; }
.share-row .hint { margin: 0; flex-basis: 100%; text-align: center; }
.share-row .hint:empty { display: none; }
td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
td.dim { color: var(--text-dim); }
.retro { color: #e0674f; font-weight: 600; }
.el-fire { color: #d9573f !important; } .el-earth { color: #5b9a4a !important; }
.el-air { color: #c9a227 !important; } .el-water { color: #3d7fcf !important; }
.asp-hard { color: #e0674f; } .asp-soft { color: #5b8fd8; }
caption { caption-side: bottom; text-align: left; padding-top: 8px; font-size: .85rem; color: var(--text-dim); }
.reading p { margin-bottom: .8em; }
@media (max-width: 600px) {
  .natal-form { padding: 16px; }
  th, td { padding: 7px 8px; }
}

/* ---------- Переключатель языка (создаётся в main.js) ---------- */
.lang-switch {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: .85rem;
}
.lang-switch a {
  padding: 5px 9px;
  color: var(--text-dim);
  text-decoration: none;
  background: var(--bg-card);
}
.lang-switch a + a { border-left: 1px solid var(--line); }
.lang-switch a:hover { color: var(--text); background: var(--bg-card-hover); }
.lang-switch a[aria-current] { color: var(--accent); font-weight: 600; }

/* Деванагари: в Georgia его нет, берутся системные шрифты */
:root[lang="hi"] body {
  font-family: Georgia, "Kohinoor Devanagari", "Nirmala UI", "Noto Serif Devanagari", "Mangal", serif;
  line-height: 1.8;
}

/* ---------- Шапка в одну строку ---------- */
.header-inner { max-width: 1180px; flex-wrap: nowrap; gap: 14px; }
nav { flex: 1 1 auto; min-width: 0; gap: 2px; }
nav a { padding: 6px 9px; white-space: nowrap; }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
/* Не помещается — меню уходит отдельной строкой под логотип и кнопки */
@media (max-width: 1060px) {
  .header-inner { flex-wrap: wrap; }
  nav { order: 3; flex-basis: 100%; }
}

/* Китайский: системные шрифты с иероглифами */
:root[lang="zh"] body {
  font-family: Georgia, "Songti SC", "Noto Serif CJK SC", "SimSun", serif;
}
:root[lang="zh"] nav a, :root[lang="zh"] .natal-form, :root[lang="zh"] table { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif; }
