/* ─────────────────────────────────────────────────────────────────
   IELTS Speaking — category grid + lesson page touches.

   The category grid mirrors the Writing pattern (FLIP-animated
   expand from 4-cell 2×2 to one fullbleed panel) but with a
   distinct Speaking palette and an audio-waveform glyph on each
   card — a subtle signature that this is the spoken-language
   subject without leaning on theatrical metaphors.
   ───────────────────────────────────────────────────────────── */

.sp-cat-section {
  margin-top: 2rem;
}

/* ── 2×2 grid (collapsed). Auto-fit so it gracefully collapses to
      a single column under ~640px. ─────────────────────────────── */
.sp-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-auto-rows: minmax(200px, auto);
  gap: 1rem;
  position: relative;
}

.sp-cat-grid.is-expanded {
  grid-auto-rows: auto;
}
.sp-cat-grid.is-expanded .sp-cat-block.is-active {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
}

@media (max-width: 640px) {
  .sp-cat-grid {
    grid-template-columns: 1fr;
  }
}

/* ── Category block ──────────────────────────────────────────── */
.sp-cat-block {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: .55rem;
  padding: 1.6rem 1.6rem 1.4rem;
  background: var(--paper, #F5EBD3);
  border: 1px solid transparent;
  border-radius: 14px;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: var(--paper-ink, #1F1812);
  overflow: hidden;
  user-select: none;
  box-shadow:
    0 1px 0 rgba(0,0,0,.18),
    0 14px 26px -18px rgba(0,0,0,.45);
  transition: opacity .35s ease,
              border-color .2s,
              box-shadow .25s,
              transform .18s cubic-bezier(.2,.8,.2,1);
}
.sp-cat-block:hover:not(.is-active),
.sp-cat-block:focus-visible:not(.is-active) {
  transform: translateY(-3px);
  border-color: var(--cat-color, #B57A2E);
  outline: none;
  box-shadow:
    0 1px 0 rgba(0,0,0,.18),
    0 22px 42px -16px rgba(0,0,0,.55);
}

/* ── Stripe ──────────────────────────────────────────────────── */
.sp-cat-stripe {
  display: block;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  margin-bottom: .35rem;
  background: var(--cat-color, #B57A2E);
  transition: width .25s ease, height .25s ease;
}

/* ── Speaking palette — a journey from contemplative blue
      through olive freshness to honey center-stage to mulberry
      analytical depth. ────────────────────────────────────────── */
.sp-cat-foundations { --cat-color: #4A6B7A; }  /* slate blue */
.sp-cat-part-1      { --cat-color: #7A8B4A; }  /* olive */
.sp-cat-part-2      { --cat-color: #B57A2E; }  /* honey — brand accent */
.sp-cat-part-3      { --cat-color: #7A4A5B; }  /* mulberry */

/* ── Waveform glyph ──────────────────────────────────────────── */
.sp-cat-wave {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  color: var(--cat-color, #B57A2E);
  opacity: .42;
  transition: opacity .25s ease;
  pointer-events: none;
}
.sp-cat-block:hover:not(.is-active) .sp-cat-wave,
.sp-cat-block:focus-visible:not(.is-active) .sp-cat-wave {
  opacity: .9;
}
.sp-cat-wave-bar {
  transform-origin: center;
  transform-box: fill-box;
}
/* On hover, the bars pulse like a live equaliser. Each bar runs
   at a slightly different speed so the pattern never repeats
   exactly — feels alive rather than mechanical. */
.sp-cat-block:hover:not(.is-active) .sp-cat-wave-bar-1 { animation: sp-wave 1.05s ease-in-out infinite; }
.sp-cat-block:hover:not(.is-active) .sp-cat-wave-bar-2 { animation: sp-wave  .85s ease-in-out infinite .08s; }
.sp-cat-block:hover:not(.is-active) .sp-cat-wave-bar-3 { animation: sp-wave  .72s ease-in-out infinite .14s; }
.sp-cat-block:hover:not(.is-active) .sp-cat-wave-bar-4 { animation: sp-wave  .95s ease-in-out infinite .04s; }
.sp-cat-block:hover:not(.is-active) .sp-cat-wave-bar-5 { animation: sp-wave 1.10s ease-in-out infinite .12s; }
@keyframes sp-wave {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(.42); }
}
@media (prefers-reduced-motion: reduce) {
  .sp-cat-wave-bar { animation: none !important; }
}

/* ── Card typography ─────────────────────────────────────────── */
.sp-cat-name {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.5rem;
  line-height: 1.15;
  font-weight: 500;
  letter-spacing: -.01em;
  color: var(--paper-ink, #1F1812);
}
.sp-cat-tagline {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .88rem;
  line-height: 1.4;
  color: var(--paper-ink-soft, #4A3F33);
  flex: 1;
  max-width: 92%;
}
.sp-cat-count {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--cat-color, #B57A2E);
  margin-top: .35rem;
}

/* ── Expanded state ──────────────────────────────────────────── */
.sp-cat-block.is-active {
  cursor: default;
  padding: 1.8rem 1.8rem 2rem;
  border-color: var(--cat-color);
  box-shadow:
    0 1px 0 rgba(0,0,0,.22),
    0 22px 50px -18px rgba(0,0,0,.55);
}
.sp-cat-block.is-active:hover { transform: none; }
.sp-cat-block.is-active .sp-cat-stripe { width: 48px; height: 5px; }
.sp-cat-block.is-active .sp-cat-name { font-size: 2rem; letter-spacing: -.015em; }
.sp-cat-block.is-active .sp-cat-tagline { font-size: .95rem; flex: 0 0 auto; }
.sp-cat-block.is-active .sp-cat-wave { opacity: .55; }

/* Non-active blocks during expand. */
.sp-cat-block.is-collapsing {
  opacity: 0;
  transform: scale(.85);
  pointer-events: none;
}

/* ── Injected back button + lesson list ──────────────────────── */
.sp-cat-back {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: transparent;
  border: 0;
  font: inherit;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .85rem;
  font-weight: 600;
  color: var(--cat-color, #B57A2E);
  cursor: pointer;
  padding: .25rem .35rem;
  margin: -.4rem 0 .8rem -.35rem;
  border-radius: 6px;
  opacity: 1;
  transition: opacity .25s ease, background .15s, color .15s;
}
.sp-cat-back.is-pre-fade { opacity: 0; }
.sp-cat-back:hover {
  background: color-mix(in srgb, var(--cat-color, #B57A2E) 12%, transparent);
  color: var(--paper-ink, #1F1812);
}

.sp-cat-lessons {
  display: flex;
  flex-direction: column;
  gap: .7rem;
  margin-top: 1.1rem;
  opacity: 1;
  transition: opacity .3s ease;
}
.sp-cat-lessons.is-pre-fade { opacity: 0; }

/* ── Lesson row inside expanded view ─────────────────────────── */
.sp-cat-lesson {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.4rem;
  padding: 1.05rem 1.4rem;
  background: rgba(255,255,255,.45);
  border: 1px solid rgba(31,24,18,.10);
  border-radius: 10px;
  text-decoration: none;
  color: var(--paper-ink, #1F1812);
  transition: transform .18s cubic-bezier(.2,.8,.2,1),
              border-color .2s, background .2s, box-shadow .2s;
}
.sp-cat-lesson:hover {
  transform: translateX(4px);
  border-color: var(--cat-color, #B57A2E);
  background: rgba(255,255,255,.7);
  box-shadow: 0 6px 14px -8px rgba(0,0,0,.4);
}
.sp-cat-lesson-num {
  font-family: 'Source Serif 4', Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 2rem;
  line-height: .9;
  color: var(--cat-color, #B57A2E);
  letter-spacing: -.02em;
  font-variant-numeric: oldstyle-nums;
  align-self: center;
}
.sp-cat-lesson-body {
  display: flex; flex-direction: column; gap: .15rem;
  min-width: 0;
}
.sp-cat-lesson-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-weight: 500;
  font-size: 1.1rem;
  line-height: 1.2;
  color: var(--paper-ink, #1F1812);
}
.sp-cat-lesson-sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .82rem;
  color: var(--paper-ink-soft, #4A3F33);
  line-height: 1.4;
}
.sp-cat-lesson-mins {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .78rem;
  color: var(--paper-ink-soft, #4A3F33);
  white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────
   Lesson page — group-tinted accent + Speaking-only blocks.
   Reuses .rd-lesson-* styles from the Reading lesson page;
   what we add here is the group-tint and two new blocks.
   ───────────────────────────────────────────────────────────── */

.sp-lesson-page.sp-lesson-foundations { --cat-color: #4A6B7A; }
.sp-lesson-page.sp-lesson-part-1      { --cat-color: #7A8B4A; }
.sp-lesson-page.sp-lesson-part-2      { --cat-color: #B57A2E; }
.sp-lesson-page.sp-lesson-part-3      { --cat-color: #7A4A5B; }

/* Recolour the lesson eyebrow + back link with the group accent. */
.sp-lesson-page .rd-lesson-eyebrow {
  color: var(--cat-color, #B57A2E);
}
.sp-lesson-page .rd-lesson-back {
  color: var(--cat-color, #B57A2E);
}

/* ── compare block (Band X vs Band Y, side-by-side) ──────────── */
.sp-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 1.4rem 0;
}
@media (max-width: 720px) {
  .sp-compare { grid-template-columns: 1fr; }
}
.sp-compare-col {
  position: relative;
  padding: 1.15rem 1.25rem 1.05rem;
  border: 1px solid rgba(31,24,18,.12);
  border-radius: 12px;
  background: rgba(255,255,255,.55);
  box-shadow: 0 1px 0 rgba(0,0,0,.05);
}
.sp-compare-low  { border-left: 3px solid #A85B47; }
.sp-compare-high { border-left: 3px solid #4F7A4A; }
.sp-compare-label {
  display: inline-block;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: .25rem .55rem;
  border-radius: 6px;
  margin-bottom: .65rem;
}
.sp-compare-low  .sp-compare-label { background: rgba(168,91,71,.12); color: #8A4533; }
.sp-compare-high .sp-compare-label { background: rgba(79,122,74,.14); color: #2F5A2C; }
.sp-compare-body p { margin: 0 0 .55rem; }
.sp-compare-body p:last-child { margin-bottom: 0; }
.sp-compare-body strong { color: var(--paper-ink, #1F1812); }

/* ── drillCta block — bottom-of-lesson handoff to drill engine ── */
.sp-drill-cta {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1.2rem;
  padding: 1.3rem 1.4rem;
  margin: 1.8rem 0 .4rem;
  background: linear-gradient(180deg,
      color-mix(in srgb, var(--cat-color, #B57A2E) 10%, transparent),
      color-mix(in srgb, var(--cat-color, #B57A2E)  4%, transparent));
  border: 1px solid color-mix(in srgb, var(--cat-color, #B57A2E) 35%, transparent);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(0,0,0,.05);
}
@media (max-width: 560px) {
  .sp-drill-cta { grid-template-columns: 1fr; }
}
.sp-drill-cta-text { display: flex; flex-direction: column; gap: .25rem; }
.sp-drill-cta-eyebrow {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cat-color, #B57A2E);
}
.sp-drill-cta-title {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: -.005em;
  line-height: 1.25;
  margin: 0;
  color: var(--paper-ink, #1F1812);
}
.sp-drill-cta-sub {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .88rem;
  line-height: 1.45;
  color: var(--paper-ink-soft, #4A3F33);
  margin: 0;
}
.sp-drill-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .7rem 1.1rem;
  background: var(--cat-color, #B57A2E);
  color: #FFFDF4;
  border-radius: 10px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .92rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .15s, filter .15s, box-shadow .15s;
  box-shadow: 0 6px 14px -6px color-mix(in srgb, var(--cat-color, #B57A2E) 60%, transparent);
}
.sp-drill-cta-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: 0 10px 18px -6px color-mix(in srgb, var(--cat-color, #B57A2E) 70%, transparent);
}

/* ── Practice "coming soon" stub ─────────────────────────────── */
.sp-coming {
  margin: 2rem 0;
  padding: 1.6rem 1.8rem;
  background: var(--paper, #F5EBD3);
  border: 1px solid rgba(31,24,18,.10);
  border-radius: 14px;
  box-shadow: 0 1px 0 rgba(0,0,0,.08);
}
.sp-coming-lead {
  font-family: 'Source Serif 4', Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.45;
  color: var(--paper-ink, #1F1812);
  margin: 0 0 .8rem;
}
.sp-coming-meta {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .9rem;
  color: var(--paper-ink-soft, #4A3F33);
  margin: 0;
}
