/* The Lessons page (public/js/ui/views/lessons.js). Linked from index.html; its rules live here and nowhere else (never in
   styles.css). The subject grid's tiles are drawn by styles.css, because ui-home.test.js loads only that file. */

.lessons { counter-reset: unit; }
/* More room on a wide screen: the Lessons page is the one page that is a catalogue, so its column is wider than the 760 px of the
   reading pages. In px, not rem: at large text the column is the window anyway. */
@media (min-width: 1000px) { main.page:has(> .lessons) { max-width: 1040px; } }
.hero--lessons h1 { display: inline-block; }
.hero--lessons h1::after { content: ''; display: block; height: 4px; margin-top: 0.35rem; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--neon-2)); }

/* A unit is a chapter: a big faded chapter number behind the kicker, the title, and the note. */
.unit { counter-increment: unit; }
.unit-header { position: relative; margin-top: 0.8rem; padding: 0.2rem 0 0.2rem 3.4rem; min-height: 3rem; }
.unit-header::before {
  content: counter(unit, decimal-leading-zero) / ''; /* decorative: "Unit 1" is already in the title */
  position: absolute; left: 0; top: 0.1rem; width: 2.8rem; text-align: center;
  font-size: 1.7rem; font-weight: 900; line-height: 1.2; letter-spacing: -0.03em;
  color: color-mix(in srgb, var(--accent) 70%, var(--bg)); /* 3:1 or more on the page in both themes (large text) */
  border-right: 3px solid var(--neon-2);
  padding-right: 0.3rem;
}
.unit-header .muted { margin-top: 0.4rem; font-size: 0.92rem; }

/* Lesson cards: one column on phones, two from about 720 px. */
.lesson-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.8rem; }
@media (min-width: 720px) { .lesson-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lesson-list > li { display: grid; grid-template-columns: minmax(0, 1fr); } /* the card fills the cell, so a row of cards is as tall as its tallest */
.lesson-card { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; align-content: flex-start; text-decoration: none; color: inherit; transition: border-color 0.15s, transform 0.15s; }
.lesson-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.lesson-body { flex: 1 1 10.5rem; min-width: 0; }
.lesson-body h3 { margin: 0.45rem 0 0.15rem; }
.lesson-body .muted { font-size: 0.9rem; }
.lesson-action { display: block; margin-top: 0.6rem; font-weight: 800; color: var(--accent); font-size: 0.92rem; }

/* The level badge: a tilted, rounded cube (the logo's shape) with the lesson's number on it. */
.lesson-number { position: relative; flex: none; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; font-weight: 800; color: var(--muted); isolation: isolate; }
.lesson-number::before {
  content: ''; position: absolute; inset: 0; z-index: -1; transform: rotate(-9deg);
  border-radius: 28%; background: var(--surface-2); border: 2px solid var(--border);
}
.lesson-card--started .lesson-number { color: var(--accent-text); }
.lesson-card--started .lesson-number::before { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 16px -2px color-mix(in srgb, var(--accent) 70%, transparent); }
.lesson-card--done .lesson-number { color: var(--cta-text); }
.lesson-card--done .lesson-number::before { background: var(--cta); border-color: var(--cta); }
.lesson-card--done { border-color: color-mix(in srgb, var(--good) 45%, var(--border)); }

@media (prefers-reduced-motion: reduce) { .lesson-card:hover { transform: none; } }
