/**
 * ConceptRecall — shared components.
 *
 * Buttons, badges, the homepage, breadcrumbs — the connective tissue that
 * makes the seven modules feel like one product.
 */

/* ---- Buttons ---- */
.cr-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--cr-space-2);
  padding: var(--cr-space-3) var(--cr-space-5);
  font-family: var(--cr-font-sans);
  font-size: var(--cr-text-sm);
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--cr-radius-full);
  cursor: pointer;
  text-decoration: none;
  transition: background var(--cr-fast) var(--cr-ease),
              transform var(--cr-fast) var(--cr-ease),
              box-shadow var(--cr-fast) var(--cr-ease);
}

.cr-btn--primary {
  color: #fff;
  background: var(--cr-accent);
}

.cr-btn--primary:hover {
  color: #fff;
  background: var(--cr-accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--cr-shadow-md);
}

.cr-btn--ghost {
  color: var(--cr-accent);
  background: var(--cr-accent-soft);
  border-color: transparent;
}

.cr-btn--ghost:hover {
  color: var(--cr-accent);
  background: #dceae7;
}

.cr-btn--outline {
  color: var(--cr-text);
  background: transparent;
  border-color: var(--cr-border-strong);
}

.cr-btn--outline:hover {
  border-color: var(--cr-accent);
  color: var(--cr-accent);
}

.cr-btn--lg {
  padding: var(--cr-space-4) var(--cr-space-6);
  font-size: var(--cr-text-base);
}

/* ---- Difficulty badge (used by ui, bookmarks, analytics) ---- */
.cr-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  font-size: var(--cr-text-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--cr-radius-full);
}

.cr-badge--beginner {
  color: var(--cr-diff-beginner);
  background: var(--cr-diff-beginner-bg);
}

.cr-badge--intermediate {
  color: var(--cr-diff-intermediate);
  background: var(--cr-diff-intermediate-bg);
}

.cr-badge--advanced {
  color: var(--cr-diff-advanced);
  background: var(--cr-diff-advanced-bg);
}

/* ---- Section heading ---- */
.cr-section {
  margin-bottom: var(--cr-space-8);
}

.cr-section__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--cr-space-4);
  margin-bottom: var(--cr-space-5);
}

.cr-section__title {
  margin: 0;
  font-size: var(--cr-text-2xl);
}

.cr-section__link {
  font-size: var(--cr-text-sm);
  font-weight: 600;
  white-space: nowrap;
}

/* ---- Breadcrumb ---- */
.cr-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cr-space-2);
  margin-bottom: var(--cr-space-5);
  font-size: var(--cr-text-sm);
  color: var(--cr-text-faint);
}

.cr-breadcrumb a {
  color: var(--cr-text-muted);
  text-decoration: none;
}

.cr-breadcrumb a:hover {
  color: var(--cr-accent);
}

.cr-breadcrumb__sep {
  color: var(--cr-border-strong);
}

/* ============================================================
   HOMEPAGE
   ============================================================ */

/* ---- Hero ---- */
.cr-hero {
  position: relative;
  padding-block: var(--cr-space-9) var(--cr-space-8);
  overflow: hidden;
}

.cr-hero__inner {
  max-width: var(--cr-container);
  margin-inline: auto;
  padding-inline: var(--cr-space-5);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--cr-space-7);
  align-items: center;
}

.cr-hero__title {
  font-size: var(--cr-text-4xl);
  line-height: 1.05;
  margin-bottom: var(--cr-space-4);
}

.cr-hero__title em {
  font-style: italic;
  color: var(--cr-accent);
}

.cr-hero__lead {
  font-family: var(--cr-font-serif);
  font-size: var(--cr-text-xl);
  color: var(--cr-text-muted);
  line-height: var(--cr-leading-snug);
  margin-bottom: var(--cr-space-6);
  max-width: 42ch;
}

.cr-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--cr-space-3);
}

/* Hero visual: a small fanned stack of decorative cards. */
.cr-hero__stack {
  position: relative;
  height: 320px;
}

.cr-hero__card {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 280px;
  height: 280px;
  padding: var(--cr-space-5);
  background: var(--cr-bg-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius-lg);
  box-shadow: var(--cr-shadow-lg);
}

.cr-hero__card:nth-child(1) {
  transform: rotate(-9deg) translate(-38px, 10px);
  opacity: 0.55;
}

.cr-hero__card:nth-child(2) {
  transform: rotate(5deg) translate(34px, -6px);
  opacity: 0.8;
}

.cr-hero__card:nth-child(3) {
  transform: rotate(-2deg);
}

.cr-hero__card-eyebrow {
  font-size: var(--cr-text-xs);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--cr-warm);
}

.cr-hero__card-term {
  font-family: var(--cr-font-serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin-top: var(--cr-space-3);
  color: var(--cr-text);
}

/* ---- Topic grid ---- */
.cr-topics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--cr-space-4);
}

.cr-topic-tile {
  display: flex;
  flex-direction: column;
  gap: var(--cr-space-2);
  padding: var(--cr-space-5);
  background: var(--cr-bg-card);
  border: 1px solid var(--cr-border);
  border-radius: var(--cr-radius-md);
  text-decoration: none;
  transition: transform var(--cr-base) var(--cr-ease-out),
              box-shadow var(--cr-base) var(--cr-ease),
              border-color var(--cr-base) var(--cr-ease);
}

.cr-topic-tile:hover {
  transform: translateY(-4px);
  box-shadow: var(--cr-shadow-md);
  border-color: var(--cr-border-strong);
}

.cr-topic-tile__name {
  font-family: var(--cr-font-serif);
  font-size: var(--cr-text-lg);
  font-weight: 600;
  color: var(--cr-text);
}

.cr-topic-tile__count {
  font-size: var(--cr-text-sm);
  color: var(--cr-text-faint);
}

/* A coloured top edge cycles through brand hues. */
.cr-topic-tile { border-top: 3px solid var(--cr-accent); }
.cr-topic-tile:nth-child(4n+2) { border-top-color: var(--cr-warm); }
.cr-topic-tile:nth-child(4n+3) { border-top-color: var(--cr-gold); }
.cr-topic-tile:nth-child(4n+4) { border-top-color: var(--cr-diff-advanced); }

/* ---- Concept of the day ---- */
.cr-cotd {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--cr-space-6);
  align-items: center;
  padding: var(--cr-space-7);
  background: var(--cr-bg-ink);
  color: var(--cr-text-invert);
  border-radius: var(--cr-radius-lg);
}

.cr-cotd__label {
  writing-mode: vertical-rl;
  font-size: var(--cr-text-xs);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--cr-warm);
}

.cr-cotd__term {
  font-family: var(--cr-font-serif);
  font-size: var(--cr-text-3xl);
  color: #fff;
  margin-bottom: var(--cr-space-3);
}

.cr-cotd__teaser {
  color: rgba(247, 244, 237, 0.72);
  margin-bottom: var(--cr-space-4);
}

/* ---- CTA band ---- */
.cr-cta-band {
  text-align: center;
  padding: var(--cr-space-8) var(--cr-space-5);
  background: var(--cr-accent-soft);
  border-radius: var(--cr-radius-lg);
}

.cr-cta-band__title {
  font-size: var(--cr-text-2xl);
  margin-bottom: var(--cr-space-3);
}

.cr-cta-band__text {
  color: var(--cr-text-muted);
  margin-inline: auto;
  margin-bottom: var(--cr-space-5);
}

/* ---- Card-grid helper (recently added / most viewed) ---- */
.cr-card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--cr-space-4);
}

/* ---- Staggered page-load reveal ---- */
@media (prefers-reduced-motion: no-preference) {
  .cr-reveal {
    opacity: 0;
    transform: translateY(16px);
    animation: cr-reveal-in var(--cr-slow) var(--cr-ease-out) forwards;
  }
  .cr-reveal:nth-child(2) { animation-delay: 0.08s; }
  .cr-reveal:nth-child(3) { animation-delay: 0.16s; }
  .cr-reveal:nth-child(4) { animation-delay: 0.24s; }
}

@keyframes cr-reveal-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Responsive ---- */
@media (max-width: 980px) {
  .cr-topics-grid,
  .cr-card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 860px) {
  .cr-hero__inner {
    grid-template-columns: 1fr;
    gap: var(--cr-space-6);
  }
  .cr-hero__stack {
    height: 260px;
    order: -1;
  }
  .cr-hero {
    padding-block: var(--cr-space-7) var(--cr-space-6);
  }
}

@media (max-width: 540px) {
  .cr-topics-grid,
  .cr-card-grid {
    grid-template-columns: 1fr;
  }
  .cr-cotd {
    grid-template-columns: 1fr;
    padding: var(--cr-space-5);
  }
  .cr-cotd__label {
    writing-mode: horizontal-tb;
  }
  .cr-section__head {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--cr-space-2);
  }
}
