/* ===== Tokens ===== */
:root {
  --bg: #0a0a0d;
  --bg-elevated: #101014;
  --ink: #ece6d9;
  --ink-dim: #a8a196;
  --gold: #c8a24d;
  --gold-soft: #e3c983;
  --wine: #5c1f2a;
  --danger: #d98a94;
  --line: rgba(200, 162, 77, 0.18);
  --font-display: Georgia, 'Times New Roman', Cambria, serif;
  --font-body: 'Segoe UI', Tahoma, Verdana, sans-serif;
  --container: 1100px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.modal-open { overflow: hidden; }

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  margin: 0;
  color: var(--ink);
}

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

ul { list-style: none; margin: 0; padding: 0; }

/* ===== Background stars ===== */
.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 10% 20%, var(--ink-dim) 0, transparent 60%),
    radial-gradient(1px 1px at 80% 10%, var(--ink-dim) 0, transparent 60%),
    radial-gradient(1px 1px at 60% 70%, var(--ink-dim) 0, transparent 60%),
    radial-gradient(1px 1px at 30% 85%, var(--ink-dim) 0, transparent 60%),
    radial-gradient(1px 1px at 90% 55%, var(--ink-dim) 0, transparent 60%),
    radial-gradient(1px 1px at 45% 40%, var(--ink-dim) 0, transparent 60%),
    radial-gradient(1px 1px at 20% 60%, var(--ink-dim) 0, transparent 60%);
  opacity: 0.35;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(10, 10, 13, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 72px;
}

.logo {
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: 0.35em;
  color: var(--gold-soft);
}

.nav {
  display: flex;
  gap: 32px;
  align-items: center;
}

.nav-link {
  font-size: 0.95rem;
  color: var(--ink-dim);
  transition: color 0.25s ease;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}

.nav-link:hover { color: var(--gold-soft); }

.nav-cta {
  color: var(--gold-soft);
  border: 1px solid var(--gold);
  padding: 8px 18px;
  border-radius: 2px;
}

.nav-cta:hover {
  background: var(--gold);
  color: #14100a;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  width: 22px;
  height: 1px;
  background: var(--gold-soft);
  display: block;
}

/* ===== Auth: login button & user menu ===== */
.btn-login {
  background: var(--gold);
  color: #14100a;
  border: 1px solid var(--gold);
  padding: 8px 22px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-login:hover {
  background: var(--gold-soft);
  box-shadow: 0 0 20px rgba(200, 162, 77, 0.45);
  transform: translateY(-1px);
}

.user-menu { position: relative; }

.user-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  color: var(--gold-soft);
  border: 1px solid var(--gold);
  padding: 8px 16px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.user-btn:hover,
.user-btn[aria-expanded="true"] {
  background: rgba(200, 162, 77, 0.1);
  box-shadow: 0 0 18px rgba(200, 162, 77, 0.25);
}

.user-name {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--gold);
  transition: transform 0.25s ease;
}

.user-btn[aria-expanded="true"] .caret { transform: rotate(180deg); }

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 100%;
  width: max-content;
  background: var(--bg-elevated);
  border: 1px solid var(--gold);
  border-radius: 3px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 18px rgba(200, 162, 77, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s;
  z-index: 30;
}

.user-dropdown::before {
  content: "";
  position: absolute;
  top: -5px;
  right: 22px;
  width: 8px;
  height: 8px;
  background: var(--bg-elevated);
  border-top: 1px solid var(--gold);
  border-left: 1px solid var(--gold);
  transform: rotate(45deg);
}

.user-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.95rem;
  text-align: left;
  padding: 12px 20px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.dropdown-item:hover,
.dropdown-item:focus-visible {
  background: rgba(200, 162, 77, 0.12);
  color: var(--gold-soft);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}

.hero-ring {
  position: absolute;
  width: min(70vw, 640px);
  height: min(70vw, 640px);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  opacity: 0.5;
  animation: rotate-slow 90s linear infinite;
}

.ring-outer, .ring-inner {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1;
  opacity: 0.35;
}

.ring-marks line {
  stroke: var(--gold);
  stroke-width: 1;
  opacity: 0.5;
}

@keyframes rotate-slow {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 640px;
}

.eyebrow {
  color: var(--gold);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  margin: 0 0 18px;
}

.hero-title {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  line-height: 1.1;
  margin-bottom: 22px;
  opacity: 0;
  animation: rise 1s ease-out 0.15s forwards;
}

.hero-text {
  color: var(--ink-dim);
  font-size: 1.05rem;
  max-width: 480px;
  margin: 0 auto 36px;
  opacity: 0;
  animation: rise 1s ease-out 0.4s forwards;
}

.hero .btn {
  opacity: 0;
  animation: rise 1s ease-out 0.65s forwards;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 14px 34px;
  font-family: var(--font-body);
  font-size: 0.95rem;
  border-radius: 2px;
  transition: all 0.3s ease;
  cursor: pointer;
}

.btn-primary {
  background: var(--gold);
  color: #14100a;
  border: 1px solid var(--gold);
}

.btn-primary:hover {
  background: var(--gold-soft);
  box-shadow: 0 0 24px rgba(200, 162, 77, 0.45);
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  color: var(--gold-soft);
  border: 1px solid var(--gold);
}

.btn-outline:hover {
  background: rgba(200, 162, 77, 0.1);
  box-shadow: 0 0 18px rgba(200, 162, 77, 0.25);
}

.btn-block {
  display: block;
  width: 100%;
}

/* ===== Sections ===== */
section {
  position: relative;
  z-index: 1;
  padding: 100px 0;
}

.section-title {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  text-align: center;
  margin-bottom: 56px;
}

/* ===== Learn cards ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.card {
  background: linear-gradient(160deg, var(--bg-elevated), #0a0a0c);
  border: 1px solid var(--line);
  padding: 40px 28px;
  text-align: center;
  border-radius: 3px;
  transition: transform 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
  opacity: 0;
  transform: translateY(20px);
}

.card.in-view {
  animation: rise 0.8s ease-out forwards;
}

.card:hover {
  transform: translateY(-6px);
  border-color: var(--gold);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5), 0 0 20px rgba(200, 162, 77, 0.15);
}

.card-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
}

.card-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.4;
}

.card h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.card p {
  color: var(--ink-dim);
  font-size: 0.95rem;
  margin: 0;
}

/* ===== Course section ===== */
.course {
  background: var(--bg-elevated);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.course-inner {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 60px;
  align-items: center;
}

.course-text .section-title {
  text-align: left;
  margin-bottom: 28px;
}

.course-list li {
  position: relative;
  padding-left: 26px;
  margin-bottom: 14px;
  color: var(--ink-dim);
}

.course-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}

.course-visual svg {
  width: 100%;
  max-width: 280px;
  display: block;
  margin: 0 auto;
}

.tarot-card-frame {
  fill: #0a0a0c;
  stroke: var(--gold);
  stroke-width: 1.2;
}

.tarot-card-sun {
  fill: none;
  stroke: var(--wine);
  stroke-width: 1.5;
}

.tarot-ray {
  stroke: var(--gold);
  stroke-width: 1;
}

.tarot-divider {
  stroke: var(--gold);
  stroke-width: 1;
  opacity: 0.6;
}

.tarot-divider.thin {
  opacity: 0.35;
}

/* ===== CTA ===== */
.cta-inner {
  text-align: center;
}

.cta .section-title {
  margin-bottom: 36px;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  text-align: center;
  color: var(--ink-dim);
  font-size: 0.85rem;
  position: relative;
  z-index: 1;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-overlay {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: rgba(4, 4, 6, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(200, 162, 77, 0.10), transparent 60%),
    linear-gradient(160deg, #131317, var(--bg));
  border: 1px solid var(--gold);
  border-radius: 3px;
  padding: 36px 36px 34px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.75), 0 0 50px rgba(200, 162, 77, 0.14);
  transform: translateY(18px) scale(0.98);
  transition: transform 0.35s ease;
}

/* тонкая внутренняя рамка — как поле таро-карты */
.modal-dialog::before {
  content: "";
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: 6px;
  left: 6px;
  border: 1px solid var(--line);
  border-radius: 2px;
  pointer-events: none;
}

.modal.open .modal-dialog {
  transform: translateY(0) scale(1);
}

.modal-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin-bottom: 22px;
}

.modal-emblem {
  width: 40px;
  height: 40px;
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.2;
}

.modal-brand-name {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.3em;
  padding-left: 0.3em;
  color: var(--gold-soft);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: 36px;
  height: 36px;
  background: none;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--ink-dim);
  font-family: var(--font-body);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.modal-close:hover {
  color: var(--gold-soft);
  border-color: var(--gold);
  transform: rotate(90deg);
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 26px;
}

.tab {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 12px 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.25s ease, border-color 0.25s ease;
}

.tab:hover { color: var(--ink); }

.tab.active {
  color: var(--gold-soft);
  border-bottom-color: var(--gold);
}

.auth-form { animation: rise 0.4s ease-out; }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--ink-dim);
}

.field input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 1rem;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.field input::placeholder { color: rgba(168, 161, 150, 0.5); }

.field input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(200, 162, 77, 0.15);
}

.field input[aria-invalid="true"] { border-color: var(--danger); }

.field-error {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--danger);
}

.field-error:empty { display: none; }

.link-btn {
  display: block;
  margin: 18px auto 0;
  background: none;
  border: none;
  padding: 4px;
  font-family: var(--font-body);
  font-size: 0.85rem;
  color: var(--ink-dim);
  cursor: pointer;
  transition: color 0.25s ease;
}

.link-btn:hover {
  color: var(--gold-soft);
  text-decoration: underline;
}

.form-note {
  margin: 12px 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--gold-soft);
}

.form-note:empty { display: none; }

/* Focus visibility */
.btn-login:focus-visible,
.user-btn:focus-visible,
.dropdown-item:focus-visible,
.modal-close:focus-visible,
.tab:focus-visible,
.link-btn:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.nav-toggle:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .course-inner {
    grid-template-columns: 1fr;
    gap: 40px;
    text-align: center;
  }
  .course-text .section-title { text-align: center; }
  .course-list { display: inline-block; text-align: left; }
  .card-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
  .header-inner { gap: 12px; }
  .nav {
    position: absolute;
    top: 72px;
    left: 0;
    right: 0;
    background: rgba(10, 10, 13, 0.97);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    gap: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
  }
  .nav.open { max-height: 220px; }
  .nav-link, .nav-cta {
    width: 100%;
    text-align: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--line);
    border-radius: 0;
  }
  .nav-toggle { display: flex; }
  .btn-login { padding: 8px 16px; font-size: 0.9rem; }
  .user-btn { padding: 8px 12px; font-size: 0.9rem; }
  .user-name { max-width: 90px; }
  .card-grid { grid-template-columns: 1fr; }
  section { padding: 70px 0; }
  .modal-dialog { padding: 32px 24px 28px; }
}

@media (max-width: 400px) {
  .logo { font-size: 1.25rem; letter-spacing: 0.22em; }
  .container { padding: 0 16px; }
}

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