/* ============================================================
   CSS CUSTOM PROPERTIES  (change these to re-theme the whole site)
   ============================================================ */
:root {
  --purple-900: #3b0764;
  --purple-800: #6b21a8;
  --purple-600: #9333ea;
  --purple-400: #c084fc;
  --purple-200: #e9d5ff;
  --purple-50:  #faf5ff;

  --white: #ffffff;
  --gray-100: #f3f4f6;
  --gray-600: #4b5563;
  --gray-800: #1f2937;

  --radius: 0.75rem;
  --shadow: 0 4px 24px rgba(107, 33, 168, 0.12);
  --shadow-lg: 0 8px 40px rgba(107, 33, 168, 0.2);
  --transition: 0.25s ease;

  --font-body: 'Segoe UI', system-ui, sans-serif;
  --font-heading: Georgia, 'Times New Roman', serif;
}

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--purple-50);
  color: var(--gray-800);
  line-height: 1.65;
  min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  background: linear-gradient(135deg, var(--purple-900) 0%, var(--purple-800) 60%, var(--purple-600) 100%);
  color: var(--white);
  padding: 1.25rem 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-lg);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.header-text h1 {
  font-family: var(--font-heading);
  font-size: clamp(1.4rem, 3vw, 2rem);
  letter-spacing: 0.02em;
}

.tagline {
  font-size: 0.85rem;
  opacity: 0.8;
  margin-top: 0.15rem;
}

/* ── nav ── */
.main-nav {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--purple-200);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(233, 213, 255, 0.3);
  transition: background var(--transition), color var(--transition);
}

.nav-link:hover,
.nav-link:focus-visible {
  background: var(--purple-200);
  color: var(--purple-900);
  outline: none;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(180deg, var(--purple-800) 0%, var(--purple-600) 100%);
  color: var(--white);
  text-align: center;
  padding: 4rem 2rem 5rem;
  clip-path: ellipse(100% 85% at 50% 0%);
}

.hero-inner { max-width: 600px; margin: 0 auto; }

.hero h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  margin-bottom: 0.75rem;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.hero p {
  font-size: 1.05rem;
  opacity: 0.9;
}

/* ============================================================
   CLASS SECTIONS (accordion)
   ============================================================ */
.sections-wrapper {
  max-width: 860px;
  margin: -2.5rem auto 3rem;
  padding: 0 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.class-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid var(--purple-200);
}

/* ── toggle button ── */
.section-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.1rem 1.4rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--purple-800);
  transition: background var(--transition);
}

.section-toggle:hover,
.section-toggle:focus-visible {
  background: var(--purple-50);
  outline: 2px solid var(--purple-400);
  outline-offset: -2px;
}

.section-toggle[aria-expanded="true"] {
  background: var(--purple-200);
  color: var(--purple-900);
  border-bottom: 1px solid var(--purple-200);
}

.section-icon { font-size: 1.3rem; flex-shrink: 0; }

.section-title { flex: 1; }

.chevron {
  font-size: 1.1rem;
  transition: transform var(--transition);
  display: inline-block;
}

.section-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

/* ── body / markdown ── */
.section-body {
  padding: 1.5rem 1.75rem 2rem;
  border-top: 2px solid var(--purple-200);
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── markdown typography ── */
.markdown-content h1,
.markdown-content h2,
.markdown-content h3 {
  font-family: var(--font-heading);
  color: var(--purple-800);
  margin: 1.25rem 0 0.5rem;
}
.markdown-content h2 { font-size: 1.3rem; border-bottom: 2px solid var(--purple-200); padding-bottom: 0.3rem; }
.markdown-content h3 { font-size: 1.1rem; }

.markdown-content p  { margin-bottom: 0.75rem; }

.markdown-content ul,
.markdown-content ol {
  margin: 0.5rem 0 0.75rem 1.5rem;
}

.markdown-content li { margin-bottom: 0.35rem; }

.markdown-content a {
  color: var(--purple-600);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.markdown-content a:hover { color: var(--purple-900); }

.markdown-content blockquote {
  border-left: 4px solid var(--purple-400);
  background: var(--purple-50);
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic;
  color: var(--gray-600);
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.95rem;
}
.markdown-content th {
  background: var(--purple-800);
  color: var(--white);
  padding: 0.5rem 0.75rem;
  text-align: left;
}
.markdown-content td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--purple-200);
}
.markdown-content tr:nth-child(even) td { background: var(--purple-50); }

.markdown-content code {
  background: var(--gray-100);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
}

.markdown-content pre {
  background: var(--gray-800);
  color: var(--purple-200);
  padding: 1rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 1rem 0;
}
.markdown-content pre code { background: none; padding: 0; color: inherit; }

.markdown-content hr {
  border: none;
  border-top: 2px solid var(--purple-200);
  margin: 1.5rem 0;
}

/* error state */
.markdown-content.error { color: #b91c1c; font-style: italic; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  text-align: center;
  padding: 1.5rem;
  background: var(--purple-900);
  color: var(--purple-200);
  font-size: 0.85rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  .header-inner { flex-direction: column; align-items: flex-start; }
  .main-nav     { gap: 0.35rem; }
  .nav-link     { font-size: 0.8rem; padding: 0.3rem 0.7rem; }
  .section-body { padding: 1rem; }
}
