/* AstroCentral Custom Styles */

/* Alpine.js: hide x-cloak elements until Alpine initializes (prevents content flash) */
[x-cloak] { display: none !important; }

/* Cosmic gradient backgrounds */
.gradient-cosmic {
  background: linear-gradient(135deg, #0f0a1e 0%, #1a1145 30%, #0d1f3c 60%, #0a0f1e 100%);
}

.gradient-gold {
  background: linear-gradient(135deg, #d4a853 0%, #f0d68a 50%, #d4a853 100%);
}

.gradient-card {
  background: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);
  border: 1px solid rgba(255,255,255,0.08);
}

.gradient-card-light {
  background: linear-gradient(145deg, #ffffff 0%, #f8f7ff 100%);
  border: 1px solid #e8e5f0;
}

/* Glass effect */
.glass {
  background: rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.glass-light {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Star field animation */
.stars {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.stars::before,
.stars::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: white;
  box-shadow:
    25px 50px 0 rgba(255,255,255,0.3),
    100px 120px 0 rgba(255,255,255,0.2),
    200px 80px 0 rgba(255,255,255,0.4),
    350px 30px 0 rgba(255,255,255,0.15),
    450px 150px 0 rgba(255,255,255,0.25),
    550px 60px 0 rgba(255,255,255,0.3),
    650px 140px 0 rgba(255,255,255,0.2),
    750px 90px 0 rgba(255,255,255,0.35),
    150px 200px 0 rgba(255,255,255,0.1),
    300px 250px 0 rgba(255,255,255,0.2),
    500px 220px 0 rgba(255,255,255,0.15),
    700px 280px 0 rgba(255,255,255,0.25),
    50px 300px 0 rgba(255,255,255,0.3),
    400px 350px 0 rgba(255,255,255,0.2),
    600px 320px 0 rgba(255,255,255,0.1),
    800px 180px 0 rgba(255,255,255,0.2),
    900px 250px 0 rgba(255,255,255,0.15),
    1000px 100px 0 rgba(255,255,255,0.25),
    1100px 300px 0 rgba(255,255,255,0.2),
    1200px 50px 0 rgba(255,255,255,0.3);
  animation: twinkle 4s ease-in-out infinite alternate;
}

.stars::after {
  animation-delay: 2s;
  box-shadow:
    75px 30px 0 rgba(255,255,255,0.25),
    180px 160px 0 rgba(255,255,255,0.15),
    280px 40px 0 rgba(255,255,255,0.3),
    420px 100px 0 rgba(255,255,255,0.2),
    520px 200px 0 rgba(255,255,255,0.35),
    630px 70px 0 rgba(255,255,255,0.15),
    720px 250px 0 rgba(255,255,255,0.2),
    830px 130px 0 rgba(255,255,255,0.3),
    950px 200px 0 rgba(255,255,255,0.2),
    1050px 150px 0 rgba(255,255,255,0.15);
}

@keyframes twinkle {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Glow text */
.text-glow {
  text-shadow: 0 0 40px rgba(212, 168, 83, 0.3);
}

/* Level progress connector */
.level-connector {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 40px;
  background: linear-gradient(to bottom, #d4a853, transparent);
}

/* Quiz styling */
.quiz-option {
  transition: all 0.2s ease;
  cursor: pointer;
}

.quiz-option:hover {
  transform: translateX(4px);
  border-color: #d4a853;
}

.quiz-option.correct {
  border-color: #22c55e;
  background-color: rgba(34, 197, 94, 0.08);
}

.quiz-option.incorrect {
  border-color: #ef4444;
  background-color: rgba(239, 68, 68, 0.05);
}

/* Smooth scroll */
html {
  scroll-behavior: smooth;
}

/* Animated counter */
.counter {
  font-variant-numeric: tabular-nums;
}

/* Constellation line decoration */
.constellation-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(212, 168, 83, 0.6);
  position: absolute;
}

/* Card hover */
.card-hover {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

/* Pulse ring animation for CTA */
.pulse-ring {
  animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(212, 168, 83, 0.4);
  }
  70% {
    transform: scale(1);
    box-shadow: 0 0 0 15px rgba(212, 168, 83, 0);
  }
  100% {
    transform: scale(0.95);
    box-shadow: 0 0 0 0 rgba(212, 168, 83, 0);
  }
}

/* Floating animation */
.float {
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Fade in on scroll */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Directory card */
.practitioner-card {
  transition: all 0.3s ease;
}

.practitioner-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.08);
}

/* Badge styles */
.badge-certified {
  background: linear-gradient(135deg, #d4a853 0%, #e8c97a 100%);
  color: #1a1145;
}

.badge-verified {
  background: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);
  color: white;
}

/* Mobile nav */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.mobile-menu.open {
  max-height: 400px;
}

/* ─── SVG Progress Ring ─── */
.progress-ring {
  transform: rotate(-90deg);
}
.progress-ring-circle {
  transition: stroke-dashoffset 1s ease-in-out;
  stroke-linecap: round;
}

/* ─── Course progress bar (article.html) ─── */
.course-bar {
  position: fixed;
  top: 64px;
  left: 0;
  right: 0;
  z-index: 40;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
@media (min-width: 1024px) {
  .course-bar { top: 80px; }
}

.course-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid #d1d5db;
  background: white;
  transition: all 0.3s ease;
}
.course-dot.done {
  background: #22c55e;
  border-color: #22c55e;
}
.course-dot.current {
  border-color: #f59e0b;
  background: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245,158,11,0.2);
}

/* ─── Lesson sidebar (desktop only) ─── */
.lesson-sidebar-col {
  width: 18rem; /* 288px — wider than the old w-56 (224px) so long lesson titles fit in ~2 lines */
}
.lesson-sidebar {
  position: sticky;
  top: 140px;
  max-height: calc(100vh - 160px);
  overflow-y: auto;
}
.lesson-sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: #6b7280;
  transition: all 0.2s ease;
  cursor: pointer;
}
.lesson-sidebar-item:hover {
  background: rgba(245, 158, 11, 0.06);
  color: #374151;
}
.lesson-sidebar-item.current {
  background: rgba(245, 158, 11, 0.1);
  color: #92400e;
  font-weight: 600;
  border-left: 3px solid #f59e0b;
}
/* Collapsible module sections in the lesson nav */
.nav-module-toggle {
  width: 100%;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 4px;
  text-align: left;
  cursor: pointer;
}
.nav-module-toggle:hover .nav-module-name { color: #92400e; }
.nav-module-num {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #9ca3af;
}
.nav-module-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #111827;
  transition: color 0.2s ease;
}
.nav-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 2px;
  color: #9ca3af;
  transition: transform 0.2s ease;
}
.nav-chevron.is-open { transform: rotate(180deg); }
.nav-module-lessons { margin: 2px 0 10px; }

/* Completed lesson marker: filled green circle with a white tick (keeps the title text un-coloured) */
.nav-check-done {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 9999px;
  background: #22c55e;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-check-done svg {
  width: 10px;
  height: 10px;
}

/* ─── Module accordion (level.html) ─── */
.module-card {
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  transition: box-shadow 0.3s ease;
}
.module-card:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}
.module-header {
  cursor: pointer;
  user-select: none;
}
.module-chevron {
  transition: transform 0.3s ease;
}
.module-lessons {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}
.module-lessons.expanded {
  /* max-height set via JS */
}

/* Lesson rows */
.lesson-row {
  display: flex;
  align-items: center;
  padding: 12px 24px;
  border-top: 1px solid #f3f4f6;
  transition: background 0.2s ease;
  text-decoration: none;
  color: inherit;
}
.lesson-row:hover {
  background: #fafafa;
}
.lesson-row.current-lesson {
  background: #fffbeb;
  border-left: 3px solid #f59e0b;
}
.lesson-row.locked {
  opacity: 0.5;
  pointer-events: none;
}

/* ─── Level card states ─── */
.level-locked {
  opacity: 0.55;
  filter: grayscale(0.2);
}

/* ─── Streak badge ─── */
.streak-badge {
  background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
  color: #78350f;
}

/* ─── Lesson completion animation ─── */
.lesson-complete-flash {
  animation: completePulse 0.6s ease;
}
@keyframes completePulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); box-shadow: 0 0 30px rgba(34,197,94,0.2); }
  100% { transform: scale(1); }
}

/* ─── Next lesson card ─── */
.next-lesson-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.next-lesson-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}
.next-lesson-card .arrow-icon {
  transition: transform 0.2s ease;
}
.next-lesson-card:hover .arrow-icon {
  transform: translateX(4px);
}

/* ─── Article content typography ─── */
.article-content {
  font-size: 1.0625rem;
  line-height: 1.8;
  color: #374151;
}

/* Headings */
.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
}
.article-content h2 {
  font-size: 1.6rem;
  margin-top: 2.8rem;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid #fde68a;
  position: relative;
  padding-left: 1rem;
}
.article-content h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.15em;
  bottom: 0.75em;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(to bottom, #f59e0b, #d97706);
}
.article-content h3 {
  font-size: 1.3rem;
  margin-top: 2.2rem;
  margin-bottom: 0.75rem;
  color: #1f2937;
}
.article-content h4 {
  font-size: 1.1rem;
  margin-top: 1.8rem;
  margin-bottom: 0.5rem;
  color: #374151;
}

/* Paragraphs */
.article-content p {
  margin-bottom: 1.25rem;
  max-width: 68ch;
}

/* Strong & emphasis */
.article-content strong {
  color: #111827;
  font-weight: 600;
}
.article-content em {
  font-style: italic;
  color: #4b5563;
}

/* Links */
.article-content a {
  color: #b45309;
  text-decoration: underline;
  text-decoration-color: #fcd34d;
  text-underline-offset: 3px;
  font-weight: 500;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.article-content a:hover {
  color: #92400e;
  text-decoration-color: #f59e0b;
}

/* Lists */
.article-content ul,
.article-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.75rem;
  max-width: 68ch;
}
.article-content ul {
  list-style-type: disc;
}
.article-content ol {
  list-style-type: decimal;
}
.article-content li {
  margin-bottom: 0.5rem;
  padding-left: 0.25rem;
}
.article-content li::marker {
  color: #d97706;
  font-weight: 600;
}
.article-content ul ul,
.article-content ol ul {
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

/* Blockquotes */
.article-content blockquote {
  position: relative;
  margin: 1.75rem 0;
  padding: 1.25rem 1.5rem 1.25rem 1.75rem;
  border-left: 4px solid #f59e0b;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-radius: 0 12px 12px 0;
  font-style: normal;
  color: #78350f;
}
.article-content blockquote::before {
  content: '\201C';
  position: absolute;
  top: -0.15rem;
  left: 0.4rem;
  font-size: 3rem;
  color: #f59e0b;
  opacity: 0.25;
  font-family: 'Playfair Display', serif;
  line-height: 1;
}
.article-content blockquote p {
  margin-bottom: 0.5rem;
  color: #78350f;
}
.article-content blockquote p:last-child {
  margin-bottom: 0;
}

/* Callouts (admonitions) — rendered from `> [!LABEL]` blocks by MarkdownService */
.article-content .callout {
  margin: 1.75rem 0;
  padding: 1rem 1.25rem 1.1rem;
  border: 1px solid #e5e7eb;
  border-left: 4px solid #94a3b8;
  border-radius: 12px;
  background: #f8fafc;
}
.article-content .callout-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #475569;
}
.article-content .callout-icon {
  font-size: 1.05rem;
  line-height: 1;
}
.article-content .callout-body > :first-child {
  margin-top: 0;
}
.article-content .callout-body > :last-child {
  margin-bottom: 0;
}

/* Callout families — border + tint + header colour */
.article-content .callout-caution {
  border-left-color: #f59e0b;
  background: #fffbeb;
}
.article-content .callout-caution .callout-header {
  color: #b45309;
}
.article-content .callout-principle {
  border-left-color: #6366f1;
  background: #eef2ff;
}
.article-content .callout-principle .callout-header {
  color: #4338ca;
}
.article-content .callout-insight {
  border-left-color: #14b8a6;
  background: #f0fdfa;
}
.article-content .callout-insight .callout-header {
  color: #0f766e;
}
.article-content .callout-note {
  border-left-color: #94a3b8;
  background: #f8fafc;
}
.article-content .callout-note .callout-header {
  color: #475569;
}
.article-content .callout-bridge {
  border-left-color: #8b5cf6;
  background: #f5f3ff;
}
.article-content .callout-bridge .callout-header {
  color: #6d28d9;
}
.article-content .callout-voice {
  border-left-color: #a16207;
  background: #fefce8;
}
.article-content .callout-voice .callout-header {
  color: #854d0e;
}

/* Tables */
.article-content table {
  width: 100%;
  margin: 1.75rem 0;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  font-size: 0.925rem;
}
.article-content thead {
  background: linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
}
.article-content thead th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-weight: 700;
  color: #1f2937;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #e5e7eb;
}
.article-content tbody td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}
.article-content tbody tr:last-child td {
  border-bottom: none;
}
.article-content tbody tr:hover {
  background: #fffbeb;
}
.article-content tbody tr:nth-child(even) {
  background: #fafafa;
}
.article-content tbody tr:nth-child(even):hover {
  background: #fffbeb;
}

/* Code */
.article-content code {
  background: #f3f4f6;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.875em;
  font-weight: 500;
  color: #1f2937;
  border: 1px solid #e5e7eb;
}
.article-content pre {
  background: #1f2937;
  border-radius: 12px;
  padding: 1.25rem;
  margin: 1.5rem 0;
  overflow-x: auto;
}
.article-content pre code {
  background: transparent;
  padding: 0;
  border: none;
  color: #e5e7eb;
  font-size: 0.875rem;
}

/* Horizontal rules */
.article-content hr {
  border: none;
  height: 2px;
  background: linear-gradient(to right, transparent, #fde68a, #f59e0b, #fde68a, transparent);
  margin: 2.5rem 0;
}

/* Images & Figures */
.article-content img {
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}
.article-content .article-figure {
  margin: 2rem 0;
  text-align: center;
}
.article-content .article-figure img {
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}
.article-content .article-figure figcaption {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: #6b7280;
  font-style: italic;
  line-height: 1.5;
}

/* Footnotes */
.article-content .footnotes {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
  font-size: 0.875rem;
  color: #6b7280;
}

/* First paragraph — slightly larger */
.article-content > p:first-of-type {
  font-size: 1.15rem;
  line-height: 1.75;
  color: #1f2937;
}

/* Print certificate */
@media print {
  .no-print { display: none; }
  .certificate-frame { border: 3px solid #d4a853; }
}

/* ─── In-lesson navigation: mobile "Lessons" button ─── */
.lessons-btn {
  font-size: 12px;
  font-weight: 600;
  color: #92400e;
  background: rgba(245, 158, 11, 0.1);
  padding: 4px 12px;
  border-radius: 9999px;
  white-space: nowrap;
}

/* ─── In-lesson navigation: mobile drawer ─── */
.lesson-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 50;
}
.lesson-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: 84%;
  max-width: 320px;
  background: white;
  z-index: 51;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
}

/* ─── In-lesson navigation: prev/next ─── */
.lesson-prevnext {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.lesson-prevnext-btn {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 46%;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  transition: all 0.2s ease;
}
.lesson-prevnext-btn:hover {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.04);
}
.lesson-prevnext-btn.next {
  text-align: right;
  margin-left: auto;
}
/* End-of-level CTA (label only, no lesson title) — let the longer label use full width instead of truncating. */
.lesson-prevnext-btn.next.end {
  max-width: none;
}
.lesson-prevnext-btn .dir {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.lesson-prevnext-btn .ttl {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
}
