/*
  Современная спокойная палитра (теплый нейтрал + бирюза + янтарь).
  Шрифты: Plus Jakarta Sans + Fraunces
*/
:root {
  --primary: #d9a23a;
  --primary-hover: #c4922f;
  --primary-rgb: 217, 162, 58;
  --secondary: #3d8b82;
  --secondary-hover: #32756e;
  --secondary-rgb: 61, 139, 130;
  --text: #3a4240;
  --heading: #141a19;
  --muted: #6e7a78;
  --bg: #f4f3ef;
  --bg-soft: rgba(61, 139, 130, 0.06);
  --surface: #ffffff;
  --border: rgba(20, 26, 25, 0.08);
  --border-strong: rgba(20, 26, 25, 0.12);
  --accent-widget: #8b6cae;
  --shadow-sm: 0 1px 2px rgba(20, 26, 25, 0.04);
  --shadow-md: 0 4px 20px rgba(20, 26, 25, 0.06);
  --shadow-lg: 0 12px 40px rgba(20, 26, 25, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
  --maxw: 1040px;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, sans-serif;
  --font-heading: "Fraunces", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 120% 80% at 100% -20%, rgba(217, 162, 58, 0.07), transparent 50%),
    radial-gradient(ellipse 100% 60% at -10% 50%, rgba(61, 139, 130, 0.06), transparent 45%);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .logo {
  font-family: var(--font-heading);
  color: var(--heading);
  font-weight: 600;
  letter-spacing: -0.02em;
}

a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.2s var(--ease);
}
a:hover {
  color: var(--primary-hover);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 2px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 clamp(1rem, 4vw, 1.5rem); width: 100%; }

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  border-bottom: 1px solid var(--border);
  background: rgba(244, 243, 239, 0.78);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4rem;
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--heading);
  transition: color 0.2s var(--ease);
}
.logo:hover { color: var(--secondary); }

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.15rem;
}
.nav a {
  font-weight: 500;
  font-size: 0.9375rem;
  color: var(--text);
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.nav a:hover {
  background: rgba(61, 139, 130, 0.1);
  color: var(--secondary-hover);
}

.nav-cta {
  background: var(--heading) !important;
  color: #fff !important;
  margin-left: 0.25rem;
}
.nav-cta:hover {
  background: var(--secondary) !important;
  color: #fff !important;
}

.nav-user {
  color: var(--muted);
  font-size: 0.875rem;
  padding: 0 0.5rem;
}
.nav-logout { display: inline; margin: 0; }
.link-button {
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
  font: inherit;
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.link-button:hover {
  background: rgba(217, 162, 58, 0.12);
  color: var(--primary-hover);
}

.main { flex: 1; padding: clamp(1.5rem, 4vw, 2.75rem) 0 clamp(2.5rem, 6vw, 4rem); }

/* ——— Footer ——— */
.site-footer {
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.5) 0%, var(--surface) 40%);
  padding: 2rem 0 2.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
@media (min-width: 640px) {
  .footer-grid { grid-template-columns: 1fr 1fr; align-items: start; }
}

.footer-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  color: var(--heading);
  margin: 0 0 0.5rem;
}
.footer-links {
  list-style: none;
  padding: 0;
  margin: 0;
}
.footer-links li { margin: 0.4rem 0; }
.footer-links a { color: var(--secondary); font-weight: 500; }
.footer-links a:hover { color: var(--primary-hover); }

.footer-note {
  margin: 1.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  grid-column: 1 / -1;
  line-height: 1.55;
}
.footer-note > p {
  margin: 0;
}
.footer-note > p.footer-title {
  margin-bottom: 0.4rem;
  color: var(--heading);
}
.footer-intro .muted { margin: 0; }
.footer-intro .footer-site {
  margin-top: 0.75rem;
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.footer-note a { color: var(--accent-widget); font-weight: 500; }
.footer-note a:hover { color: var(--secondary); }

.muted { color: var(--muted); }
.lead {
  color: var(--muted);
  max-width: 38rem;
  font-size: 1.05rem;
  line-height: 1.7;
}

h1 { font-size: clamp(1.65rem, 4vw, 2.15rem); margin-top: 0; margin-bottom: 0.5rem; }
h2 { font-size: clamp(1.15rem, 2.5vw, 1.35rem); margin-top: 2rem; margin-bottom: 0.75rem; }

/* ——— Course grid ——— */
.course-grid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.course-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.2s var(--ease);
}
.course-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(61, 139, 130, 0.2);
}

.course-card > a:first-child {
  display: block;
  overflow: hidden;
}
.course-card > a:first-child img {
  width: 100%;
  height: 168px;
  object-fit: cover;
  margin: 0;
  display: block;
  transition: transform 0.4s var(--ease);
}
.course-card:hover > a:first-child img { transform: scale(1.03); }

.course-card h2 {
  font-size: 1.15rem;
  margin: 0;
  padding: 1rem 1.15rem 0.35rem;
  font-family: var(--font-heading);
}
.course-card > a:first-child + h2 {
  padding-top: 0.85rem;
}
.course-card h2 a { color: var(--heading); }
.course-card h2 a:hover { color: var(--secondary); }

.course-card > p:not(.badge-upcoming) {
  margin: 0;
  padding: 0.35rem 1.15rem 1.2rem;
  font-size: 0.98rem;
  color: var(--muted);
  line-height: 1.55;
}

.course-card-link-wrap {
  margin: 0;
  padding: 0 1.15rem 1.15rem;
}
.course-card-external {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--secondary);
  text-decoration: underline;
  text-decoration-color: rgba(61, 139, 130, 0.35);
  text-underline-offset: 0.15em;
}
.course-card-external:hover {
  color: var(--secondary-hover);
  text-decoration-color: rgba(61, 139, 130, 0.55);
}

.course-cover img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.lesson-groups {
  display: flex;
  flex-direction: column;
  gap: 1.65rem;
}
.lesson-day-heading {
  font-family: var(--font-heading);
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 0.45rem;
  letter-spacing: -0.01em;
}
.lesson-day-group:first-child .lesson-day-heading {
  margin-top: 0;
}
.lesson-list-grouped {
  margin: 0;
}

.lesson-list { padding-left: 1.35rem; }
.lesson-list li { margin: 0.45rem 0; }
.lesson-list a { font-weight: 600; }
.lesson-title-pending {
  font-weight: 600;
  color: var(--muted);
  cursor: default;
}

.video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: var(--radius);
  background: #121816;
  margin: 1.25rem 0;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
}
.video-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.prose { max-width: 52rem; }

.attachments { list-style: disc; padding-left: 1.35rem; }

.breadcrumb { margin-bottom: 1.25rem; font-size: 0.95rem; }
.breadcrumb a { font-weight: 600; }

.form-card {
  max-width: 24rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}
.form-card label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.875rem; font-weight: 500; }
.form-card input[type="text"],
.form-card input[type="password"],
.form-card input[type="email"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--heading);
  font: inherit;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.form-card input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(61, 139, 130, 0.15);
}

.btn {
  display: inline-block;
  padding: 0.6rem 1.2rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--heading);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: transform 0.15s var(--ease), box-shadow 0.2s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease);
}
.btn:hover {
  border-color: rgba(20, 26, 25, 0.18);
  box-shadow: var(--shadow-sm);
}
.btn:active { transform: scale(0.98); }

.btn.primary {
  background: linear-gradient(135deg, var(--secondary) 0%, #2f6d66 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 2px 12px rgba(61, 139, 130, 0.35);
}
.btn.primary:hover {
  background: linear-gradient(135deg, var(--secondary-hover) 0%, #285e58 100%);
  color: #fff;
  box-shadow: 0 4px 18px rgba(61, 139, 130, 0.4);
}

.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.msg { padding: 0.75rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 0.5rem; font-size: 0.95rem; }
.msg-success {
  background: rgba(61, 139, 130, 0.1);
  border: 1px solid rgba(61, 139, 130, 0.25);
  color: var(--heading);
}
.msg-error {
  background: rgba(200, 60, 60, 0.08);
  border: 1px solid rgba(200, 60, 60, 0.22);
  color: #8b2a2a;
}
.msg-info, .msg-debug {
  background: rgba(217, 162, 58, 0.1);
  border: 1px solid rgba(217, 162, 58, 0.25);
  color: var(--heading);
}

.errors { color: #b44; padding-left: 1.25rem; }

.badge {
  display: inline-block;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-size: 0.9rem;
  margin: 0 0 1rem;
  font-weight: 500;
}
.badge-draft {
  background: rgba(217, 162, 58, 0.15);
  border: 1px solid rgba(217, 162, 58, 0.35);
  color: var(--heading);
}
.badge-draft-inline {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-left: 0.35rem;
  font-weight: 700;
}
.badge-scheduled {
  font-size: 0.75rem;
  margin-left: 0.35rem;
  color: var(--accent-widget);
  font-weight: 700;
}

.course-card-upcoming {
  opacity: 0.97;
  cursor: pointer;
}
.course-card-upcoming:focus-visible {
  outline: 2px solid var(--secondary);
  outline-offset: 3px;
}
.course-card-upcoming:hover { transform: none; }
.course-card-upcoming:hover img { transform: none; }

.course-cover-placeholder { display: block; padding: 0; overflow: hidden; }
.course-cover-placeholder img {
  width: 100%;
  height: 168px;
  object-fit: cover;
  display: block;
  filter: grayscale(0.35) brightness(0.97);
  transition: transform 0.4s var(--ease);
}
.course-card:not(.course-card-upcoming):hover .course-cover-placeholder img {
  transform: scale(1.03);
}
.course-title-static {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 0;
  color: var(--heading);
  padding: 1rem 1.15rem 0.35rem;
}
.course-cover-placeholder + .course-title-static {
  padding-top: 0.85rem;
}
.upcoming-dialog {
  padding: 0;
  border: none;
  max-width: min(22rem, calc(100vw - 2rem));
  background: transparent;
}
.upcoming-dialog::backdrop {
  background: rgba(20, 26, 25, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}
.upcoming-dialog-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.45rem 1.35rem 1.35rem;
  box-shadow: var(--shadow-lg);
}
.upcoming-dialog-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin: 0 0 0.6rem;
  color: var(--heading);
}
.upcoming-dialog-text {
  margin: 0 0 1.2rem;
  color: var(--text);
  font-size: 0.98rem;
  line-height: 1.55;
}
.upcoming-dialog-box .btn { margin: 0; }

.badge-upcoming {
  display: inline-block;
  margin: 0 0 0.6rem 1.15rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-widget);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.35rem 0.65rem;
  background: rgba(139, 108, 174, 0.1);
  border-radius: 999px;
}

.progress-summary {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 0.98rem;
}
.progress-bar {
  display: block;
  height: 10px;
  background: rgba(20, 26, 25, 0.08);
  border-radius: 999px;
  margin-top: 0.65rem;
  max-width: 320px;
  overflow: hidden;
}
.progress-bar-fill {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--secondary), #5cb3a8);
  border-radius: 999px;
  min-width: 0;
  transition: width 0.4s var(--ease);
}
.lesson-done {
  color: var(--secondary);
  font-weight: 800;
  margin-left: 0.35rem;
}

.lesson-meta-actions {
  margin: 0 0 1.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}
.inline-form { display: inline; margin: 0; }
.btn-outline {
  background: transparent;
  border: 2px solid var(--secondary);
  color: var(--secondary);
}
.btn-outline:hover {
  background: rgba(61, 139, 130, 0.08);
  color: var(--secondary-hover);
  box-shadow: none;
}

.audio-list { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.audio-item {
  margin: 1rem 0;
  padding: 1.15rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.audio-title { margin: 0 0 0.5rem; font-weight: 700; color: var(--heading); font-size: 0.95rem; }
.audio-item audio { width: 100%; max-width: 560px; vertical-align: middle; border-radius: var(--radius-sm); }

.feedback-form { max-width: 36rem; }
.feedback-textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font: inherit;
  resize: vertical;
  min-height: 8rem;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.feedback-textarea:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(61, 139, 130, 0.12);
  outline: none;
}
.feedback-form input[type="text"] {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  font: inherit;
}

.lesson-toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  margin: 1.5rem 0;
  box-shadow: var(--shadow-sm);
}
.lesson-toc .toc-title {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
  font-family: var(--font-heading);
}
.lesson-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.lesson-toc li { margin: 0.4rem 0; }
.lesson-toc a { font-weight: 600; }
.lesson-toc .toc-level-3 { padding-left: 1rem; font-size: 0.95rem; }

.lesson-body .lesson-heading {
  scroll-margin-top: 5.5rem;
  margin-top: 1.75rem;
  font-family: var(--font-heading);
}
.lesson-body .lesson-para { margin: 0.85rem 0; }

.search-form { margin-bottom: 1.75rem; }
.search-form label { display: block; margin-bottom: 0.4rem; color: var(--muted); font-size: 0.875rem; font-weight: 500; }
.search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}
.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.65rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font: inherit;
  background: var(--surface);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.search-input:focus {
  border-color: var(--secondary);
  box-shadow: 0 0 0 3px rgba(61, 139, 130, 0.12);
  outline: none;
}
.search-results { list-style: none; padding: 0; margin: 0; }
.search-results li { margin: 0.65rem 0; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border); }
.search-results li:last-child { border-bottom: 0; }

.login-extra { margin-top: 1.25rem; font-size: 0.95rem; }

/* Registration / password reset forms */
.registration-form input,
.registration-form textarea {
  border-radius: var(--radius-sm);
}
