/* WordsHeap — тема для изучения китайского языка */

:root {
  --wh-bg: #f0ebe3;
  --wh-bg-warm: #e8e2d8;
  --wh-surface: #fffcf7;
  --wh-surface-2: #faf6ef;
  --wh-ink: #141821;
  --wh-ink-soft: #3d4454;
  --wh-muted: #6b7280;
  --wh-vermillion: #c41e3a;
  --wh-vermillion-light: #e85d6f;
  --wh-vermillion-dark: #9e1830;
  --wh-jade: #0d7a6b;
  --wh-jade-dark: #095c52;
  --wh-gold: #b8860b;
  --wh-gold-soft: rgba(184, 134, 11, 0.12);
  --wh-radius: 1rem;
  --wh-radius-sm: 0.65rem;
  --wh-shadow: 0 12px 40px rgba(20, 24, 33, 0.08);
  --wh-shadow-sm: 0 4px 16px rgba(20, 24, 33, 0.06);
  --wh-font-ui: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --wh-font-display: "Noto Serif SC", "Source Han Serif SC", "Songti SC", serif;
  --wh-font-mono: "JetBrains Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--wh-font-ui);
  color: var(--wh-ink);
  background-color: var(--wh-bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 100% -20%, rgba(196, 30, 58, 0.07), transparent 50%),
    radial-gradient(ellipse 80% 60% at -10% 60%, rgba(13, 122, 107, 0.06), transparent 45%),
    linear-gradient(180deg, var(--wh-bg) 0%, var(--wh-bg-warm) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%23141821' stroke-width='0.5'%3E%3Cpath d='M30 0v60M0 30h60'/%3E%3C/g%3E%3C/svg%3E");
}

.wh-navbar {
  position: relative;
  z-index: 1030;
  background: linear-gradient(118deg, #0f1319 0%, #1a222e 42%, #132028 100%) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.wh-navbar .navbar-brand {
  font-family: var(--wh-font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  color: #faf8f5 !important;
  line-height: 1.15;
}

.wh-navbar .brand-tagline {
  display: block;
  font-family: var(--wh-font-display);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.35em;
  color: rgba(250, 248, 245, 0.55);
  margin-top: 0.1rem;
}

.wh-navbar .nav-link {
  color: rgba(255, 255, 255, 0.78) !important;
  font-weight: 500;
  font-size: 0.925rem;
  padding: 0.5rem 0.85rem !important;
  border-radius: var(--wh-radius-sm);
  transition: color 0.2s, background 0.2s;
}

.wh-navbar .nav-link:hover,
.wh-navbar .nav-link:focus {
  color: #fff !important;
  background: rgba(255, 255, 255, 0.08);
}

.wh-navbar .navbar-text {
  color: rgba(255, 255, 255, 0.65) !important;
  font-size: 0.875rem;
}

.wh-navbar .form-select {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.15);
  color: #f5f3ef;
  max-width: 9rem;
}

.wh-navbar .form-select:focus {
  border-color: var(--wh-vermillion-light);
  box-shadow: 0 0 0 0.2rem rgba(196, 30, 58, 0.25);
}

.wh-navbar .btn-outline-light {
  border-color: rgba(255, 255, 255, 0.35);
  color: #faf8f5;
}

.wh-navbar .btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.5);
  color: #fff;
}

.wh-navbar .btn-warning {
  background: linear-gradient(135deg, var(--wh-gold) 0%, #d4a017 100%);
  border: none;
  color: #1a1510;
  font-weight: 600;
}

.wh-navbar .btn-warning:hover {
  filter: brightness(1.08);
  color: #1a1510;
}

.wh-main {
  position: relative;
  /* не задавать z-index: иначе весь <main> окажется под .modal-backdrop Bootstrap,
     и модалки внутри страницы будут невидимы (только серый фон). */
  flex: 1 0 auto;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.wh-footer {
  position: relative;
  z-index: 1;
  background: linear-gradient(180deg, #0c0f14 0%, #080a0d 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding: 1.75rem 0 !important;
  margin-top: 0 !important;
}

.wh-footer .footer-inner {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.45);
  letter-spacing: 0.02em;
}

.wh-footer .footer-cn {
  font-family: var(--wh-font-display);
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.8rem;
  letter-spacing: 0.2em;
}

/* Bootstrap overrides */
.btn-primary {
  --bs-btn-bg: var(--wh-vermillion);
  --bs-btn-border-color: var(--wh-vermillion);
  --bs-btn-hover-bg: var(--wh-vermillion-dark);
  --bs-btn-hover-border-color: var(--wh-vermillion-dark);
  --bs-btn-active-bg: var(--wh-vermillion-dark);
  --bs-btn-active-border-color: var(--wh-vermillion-dark);
  font-weight: 600;
  border-radius: var(--wh-radius-sm);
  padding: 0.5rem 1.15rem;
}

.btn-success {
  --bs-btn-bg: var(--wh-jade);
  --bs-btn-border-color: var(--wh-jade);
  --bs-btn-hover-bg: var(--wh-jade-dark);
  --bs-btn-hover-border-color: var(--wh-jade-dark);
  border-radius: var(--wh-radius-sm);
  font-weight: 600;
}

.btn-outline-primary {
  color: var(--wh-vermillion);
  border-color: var(--wh-vermillion);
  border-radius: var(--wh-radius-sm);
  font-weight: 600;
}

.btn-outline-primary:hover {
  background: var(--wh-vermillion);
  border-color: var(--wh-vermillion);
}

.card {
  background: var(--wh-surface);
  border: 1px solid rgba(20, 24, 33, 0.06);
  border-radius: var(--wh-radius);
  box-shadow: var(--wh-shadow-sm);
}

.card-header {
  background: var(--wh-surface-2);
  border-bottom-color: rgba(20, 24, 33, 0.06);
  font-weight: 600;
  border-radius: var(--wh-radius) var(--wh-radius) 0 0 !important;
}

.list-group-item {
  background: var(--wh-surface);
  border-color: rgba(20, 24, 33, 0.06);
}

.list-group-item-action:hover {
  background: var(--wh-gold-soft);
}

.table {
  --bs-table-bg: var(--wh-surface);
}

.form-control,
.form-select {
  border-radius: var(--wh-radius-sm);
  border-color: rgba(20, 24, 33, 0.12);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--wh-jade);
  box-shadow: 0 0 0 0.2rem rgba(13, 122, 107, 0.15);
}

.alert {
  border-radius: var(--wh-radius-sm);
  border: none;
}

.alert-success {
  background: rgba(13, 122, 107, 0.12);
  color: var(--wh-jade-dark);
}

.alert-danger {
  background: rgba(196, 30, 58, 0.1);
  color: var(--wh-vermillion-dark);
}

.alert-warning {
  background: var(--wh-gold-soft);
  color: #6b5200;
}

.alert-info {
  background: rgba(26, 34, 46, 0.06);
  color: var(--wh-ink-soft);
}

/* Анализ текста — слова из словаря */
.wh-analyze-highlight {
  font-family: var(--wh-font-display);
  word-break: break-word;
}

.wh-analyze-known {
  cursor: help;
  padding: 0.08em 0.2em;
  border-radius: 0.28em;
  background: var(--wh-gold-soft);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  transition: background 0.15s ease;
}

.wh-analyze-known:hover {
  background: rgba(13, 122, 107, 0.2);
}

/* Заголовки страниц */
.wh-page-title {
  font-family: var(--wh-font-display);
  font-weight: 700;
  color: var(--wh-ink);
  letter-spacing: 0.02em;
}

/* Главная — герой */
.wh-hero {
  position: relative;
  overflow: hidden;
  border-radius: calc(var(--wh-radius) + 4px);
  background: linear-gradient(145deg, #1a2332 0%, #152028 38%, #1c2838 100%);
  color: #faf8f5;
  padding: clamp(2.5rem, 6vw, 4rem) clamp(1.5rem, 4vw, 3rem);
  box-shadow: var(--wh-shadow);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.wh-hero::before {
  content: "";
  position: absolute;
  top: -40%;
  right: -15%;
  width: 55%;
  height: 140%;
  background: radial-gradient(circle, rgba(196, 30, 58, 0.22) 0%, transparent 62%);
  pointer-events: none;
}

.wh-hero::after {
  content: "学";
  position: absolute;
  right: 6%;
  bottom: 8%;
  font-family: var(--wh-font-display);
  font-size: clamp(5rem, 18vw, 12rem);
  line-height: 1;
  color: rgba(255, 255, 255, 0.04);
  pointer-events: none;
  user-select: none;
}

.wh-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 38rem;
}

.wh-hero-badge {
  display: inline-block;
  font-family: var(--wh-font-display);
  font-size: 0.8rem;
  letter-spacing: 0.45em;
  color: rgba(250, 248, 245, 0.55);
  margin-bottom: 1rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--wh-vermillion);
}

.wh-hero h1 {
  font-family: var(--wh-font-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 4vw, 2.5rem);
  line-height: 1.2;
  margin-bottom: 1rem;
  color: #fff;
}

.wh-hero-lead {
  font-size: clamp(1rem, 2.2vw, 1.15rem);
  line-height: 1.65;
  color: rgba(250, 248, 245, 0.78);
  margin-bottom: 1.75rem;
}

.wh-hero .btn-primary {
  padding: 0.65rem 1.5rem;
  font-size: 1.05rem;
  box-shadow: 0 8px 24px rgba(196, 30, 58, 0.35);
}

.wh-hero .btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(196, 30, 58, 0.4);
}

/* Карточки входа / регистрации */
.wh-auth-card {
  border: 1px solid rgba(20, 24, 33, 0.08);
  box-shadow: var(--wh-shadow);
}

.wh-auth-card .card-body {
  padding: 2rem;
}

.wh-auth-card h2 {
  font-family: var(--wh-font-display);
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.wh-auth-card label {
  display: block;
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.35rem;
  color: var(--wh-ink-soft);
}

.wh-auth-card input[type="text"],
.wh-auth-card input[type="password"],
.wh-auth-card input[type="email"] {
  display: block;
  width: 100%;
  padding: 0.55rem 0.85rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: var(--wh-radius-sm);
  border: 1px solid rgba(20, 24, 33, 0.12);
  background: var(--wh-surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.wh-auth-card input[type="text"]:focus,
.wh-auth-card input[type="password"]:focus,
.wh-auth-card input[type="email"]:focus {
  outline: none;
  border-color: var(--wh-jade);
  box-shadow: 0 0 0 0.2rem rgba(13, 122, 107, 0.15);
}

.wh-auth-card ul.errorlist {
  list-style: none;
  padding: 0;
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--wh-vermillion-dark);
}

.wh-auth-footer-link {
  color: var(--wh-jade);
}

.wh-auth-footer-link:hover {
  color: var(--wh-jade-dark);
}

/* Китайский текст в контенте чуть крупнее и с правильным шрифтом */
.font-han,
[lang="zh"],
[lang="zh-CN"] {
  font-family: var(--wh-font-display);
}

/* Аккордеон урока */
.accordion-button:not(.collapsed) {
  background: var(--wh-surface-2);
  color: var(--wh-ink);
  box-shadow: none;
}

.accordion-button:focus {
  box-shadow: 0 0 0 0.2rem rgba(13, 122, 107, 0.15);
}

/* Хлебные крошки */
.breadcrumb {
  font-size: 0.9rem;
}

.breadcrumb-item a {
  color: var(--wh-jade);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-item a:hover {
  text-decoration: underline;
  color: var(--wh-jade-dark);
}

@media (max-width: 991.98px) {
  .wh-navbar .form-select {
    margin-bottom: 0.5rem;
    max-width: 100%;
  }
}

/* Заголовки страниц внутри контента */
main h1,
main .h1 {
  font-family: var(--wh-font-display);
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--wh-ink);
}

main h2,
main .h2 {
  font-family: var(--wh-font-display);
  font-weight: 700;
}

main .table .fw-semibold {
  font-family: var(--wh-font-display);
  font-weight: 600;
}

.wh-lesson-cover {
  max-height: min(420px, 55vh);
  width: 100%;
  object-fit: cover;
  object-position: center;
}

.wh-lesson-cover-thumb {
  max-height: 200px;
  width: auto;
  object-fit: contain;
}

.wh-course-card-link .card {
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.wh-course-card-link:hover .card {
  box-shadow: var(--wh-shadow) !important;
  transform: translateY(-2px);
}
