/* Site-wide "maths notebook" polish: playful but professional. Decoration only; no content or layout changes.
   Loaded from base.html. Everything is subtle and respects prefers-reduced-motion. */

:root { --pf-blue: #1a73e8; --pf-violet: #4285f4; --pf-amber: #fbbc05; --pf-ink: #0f172a; }

/* 1. Section headings: a maths-notebook squiggle under every title, and a small glyph before kickers */
.dm-section-title,
.dm-home-bundles__title { position: relative; padding-bottom: 0.9rem; }
.dm-section-title::after,
.dm-home-bundles__title::after {
  content: "";
  display: block;
  width: 86px;
  height: 10px;
  margin: 0.55rem auto 0;
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 86 10' fill='none'%3E%3Cpath d='M2 6 Q9 0 16 5 T30 5 T44 5 T58 5 T72 5 T84 4' stroke=%27%23f5a524%27 stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E");
}
.dm-kicker::before, .dm-home-bundles__eyebrow::before {
  content: "∑";
  display: inline-block;
  margin-right: 0.45rem;
  color: var(--pf-amber);
  font-weight: 800;
}

/* 2. (graph paper now lives on <body>; see theme.css) */
.dm-section { position: relative; }
.dm-section > .container { position: relative; z-index: 1; }

/* 3. Cards: friendly lift on hover, accent bar, arrow that moves */
.dm-course-card-popular { transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease; position: relative; }
.dm-course-card-popular::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--pf-blue), var(--pf-violet), var(--pf-amber));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s ease;
  border-radius: 0 0 inherit inherit;
}
.dm-course-card-popular:hover, .dm-course-card-popular:focus-visible {
  transform: translateY(-6px);
  box-shadow: 0 18px 38px rgba(26, 115, 232, 0.16);
}
.dm-course-card-popular:hover::after, .dm-course-card-popular:focus-visible::after { transform: scaleX(1); }
.dm-course-card-popular__link .bi { display: inline-block; transition: transform 0.2s ease; }
.dm-course-card-popular:hover .dm-course-card-popular__link .bi { transform: translateX(5px); }

/* 4. Course page: module cards and lesson rows feel clickable and alive */
.dm-topic-card { transition: box-shadow 0.22s ease, transform 0.22s ease; }
.dm-topic-card:hover { box-shadow: 0 14px 32px rgba(15, 23, 42, 0.09); transform: translateY(-2px); }
.dm-topic-card__lesson { transition: background-color 0.15s ease, transform 0.15s ease; }
a.dm-topic-card__lesson:hover { transform: translateX(4px); }
.dm-topic-card__lesson-seq { transition: transform 0.2s ease; }
a.dm-topic-card__lesson:hover .dm-topic-card__lesson-seq { transform: rotate(-8deg) scale(1.08); }

/* 5. Progress bars: colourful fill, soft shimmer, a pop when a lesson is completed */
.dm-lesson-progress-track__fill,
.dm-hub-progress__fill {
  background: linear-gradient(90deg, var(--pf-blue), var(--pf-violet), var(--pf-amber)) !important;
  background-size: 200% 100% !important;
  transition: width 0.7s cubic-bezier(0.22, 1, 0.36, 1);
  animation: pf-shimmer 4s linear infinite;
}
@keyframes pf-shimmer { to { background-position: -200% 0; } }
.dm-lesson-progress-track.pf-pop { animation: pf-pop 0.6s ease; }
@keyframes pf-pop { 0% { transform: scale(1); } 40% { transform: scale(1.04); } 100% { transform: scale(1); } }

/* encouraging line under a progress bar */
.pf-nudge {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0.6rem 0 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: #3870ca;
}
.pf-nudge::before { content: "∑"; color: var(--pf-amber); font-weight: 800; }

/* 6. Encouraging "completed" badge gets a tiny bounce */
.dm-lesson-complete-badge__tick { display: inline-block; animation: pf-tick 0.5s ease 1; }
@keyframes pf-tick { 0% { transform: scale(0.2) rotate(-30deg); } 70% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* 7. Course / bundle page header: graph paper behind the title block */
.dm-syllabus-hero, .dm-course-hero { position: relative; }

@media (prefers-reduced-motion: reduce) {
  .dm-course-card-popular, .dm-topic-card, .dm-topic-card__lesson, .dm-topic-card__lesson-seq { transition: none; }
  .dm-lesson-progress-track__fill, .dm-hub-progress__fill, .dm-lesson-complete-badge__tick, .dm-lesson-progress-track.pf-pop { animation: none; }
  .dm-course-card-popular:hover, .dm-topic-card:hover { transform: none; }
}
