/**
 * djtutor.com :: browse-sections module (mod_djtutor_sections)
 *
 * Entry points to everything outside the curriculum. Built from the --djt-* design tokens only,
 * so the brand and the light/dark scheme come for free.
 *
 * Layout: a tinted band that bleeds to the viewport edges (no extra markup: a huge box-shadow
 * clipped to the element's own height), with three cards in the first row and two wider ones in
 * the second, so none of the five is squeezed. Each card reads as count | title + text, with the
 * section's accent colour on the leading edge.
 */

.djt-sections {
  position: relative;
  padding: clamp(2.75rem, 5.5vw, 4rem) 0;
  background: var(--djt-bg-alt, #f4f7fc);
  box-shadow: 0 0 0 100vmax var(--djt-bg-alt, #f4f7fc);
  clip-path: inset(0 -100vmax);
}

.djt-sections__intro {
  max-width: 68ch;
  margin: 0 0 clamp(1.5rem, 3.5vw, 2.25rem);
}

.djt-sections__heading {
  margin: 0 0 .6rem;
  font-size: var(--djt-fs-2xl, 1.75rem);
  line-height: var(--djt-lh-tight, 1.15);
  letter-spacing: -.015em;
  color: var(--djt-text-strong, #0b1220);
}

.djt-sections__standfirst {
  max-width: 62ch;
  margin: 0;
  font-size: var(--djt-fs-md, 1rem);
  line-height: var(--djt-lh-body, 1.6);
  color: var(--djt-muted, #5b6578);
}

/* ----------------------------------------------------------------- grid -- */

.djt-sections__list {
  display: grid;
  gap: clamp(.875rem, 1.8vw, 1.25rem);
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 40rem) {
  .djt-sections__list { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* five items in two columns: the last one spans the row */
  .djt-sections__item:last-child:nth-child(odd) { grid-column: 1 / -1; }
}

@media (min-width: 64rem) {
  .djt-sections__list { grid-template-columns: repeat(6, minmax(0, 1fr)); }

  .djt-sections__item { grid-column: span 2; }

  .djt-sections__item:last-child:nth-child(odd) { grid-column: span 3; }

  .djt-sections__item:nth-last-child(2) { grid-column: span 3; }
}

/* ----------------------------------------------------------------- card -- */

.djt-sections__link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "count title"
    "count text"
    "count go";
  column-gap: 1rem;
  height: 100%;
  padding: 1.125rem 1.25rem 1.125rem 1.125rem;
  background: var(--djt-surface, #fff);
  border: 1px solid var(--djt-border, #d8dfea);
  border-inline-start: 4px solid var(--_accent, var(--djt-brand, #2152ad));
  border-radius: var(--djt-radius, .625rem);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--djt-dur, .18s) ease, box-shadow var(--djt-dur, .18s) ease, transform var(--djt-dur, .18s) ease;
}

.djt-sections__link:hover,
.djt-sections__link:focus-visible {
  border-color: var(--djt-border-strong, #b7c2d4);
  border-inline-start-color: var(--_accent, var(--djt-brand, #2152ad));
  box-shadow: var(--djt-shadow, 0 8px 24px rgba(13, 32, 69, .10));
  transform: translateY(-2px);
}

.djt-sections__link:focus-visible {
  outline: 3px solid var(--djt-focus, #2152ad);
  outline-offset: 3px;
}

.djt-sections__count {
  grid-area: count;
  align-self: start;
  min-width: 3.5rem;
  padding-top: .1rem;
  font-size: var(--djt-fs-2xl, 1.75rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.025em;
  font-variant-numeric: tabular-nums;
  color: var(--_accent, var(--djt-brand, #2152ad));
}

.djt-sections__title {
  grid-area: title;
  font-size: var(--djt-fs-card, 1.0625rem);
  font-weight: 600;
  line-height: var(--djt-lh-snug, 1.3);
  color: var(--djt-text-strong, #0b1220);
}

.djt-sections__link:hover .djt-sections__title {
  color: var(--djt-ink, #2152ad);
}

.djt-sections__text {
  grid-area: text;
  margin-top: .25rem;
  font-size: var(--djt-fs-sm, .875rem);
  line-height: var(--djt-lh-body, 1.6);
  color: var(--djt-muted, #5b6578);
}

.djt-sections__go {
  grid-area: go;
  align-self: end;
  margin-top: .75rem;
  font-size: var(--djt-fs-sm, .875rem);
  font-weight: 700;
  color: var(--djt-ink, #2152ad);
}

/* Per-section accent, matching the badge palette used on the cards elsewhere. */
.djt-sections__item--business      { --_accent: var(--djt-badge-business-fg, #176640); }
.djt-sections__item--product_test  { --_accent: var(--djt-badge-review-fg, #4a2a8a); }
.djt-sections__item--product_intro { --_accent: var(--djt-badge-intro-fg, #7a3e05); }
.djt-sections__item--promo         { --_accent: var(--djt-badge-promo-fg, #3b4454); }

@media (prefers-reduced-motion: reduce) {
  .djt-sections__link { transition: none; }
  .djt-sections__link:hover,
  .djt-sections__link:focus-visible { transform: none; }
}
