/* ===========================================================================
   Simple courses (2026-11-02, owner: "the site is cluttered").

   One way to the lessons: Courses -> a course page with only its own lessons
   -> a lesson. Loaded after pages.css (and living.css), so these rules win at
   equal specificity. Nothing in pages.css is edited.

   - .sc-card       the course card (partial/course-card.php): a big 16:9
                    picture, the title, the lesson count; the whole card is one link.
   - .sc-page       the /courses page: a title and the cards, nothing else.
   - .sc-course     one course page: title, text, one button, its lessons.
   - .sc-rail-head  the course name over the lesson list beside the player.

   Course cards: 1 column on a phone, 2 from 700px, 3 from 1100px.
   To undo: remove the <link> to this file from views/layout/site.php.
   =========================================================================== */

/* ---- course grid: only grids that hold the new cards are re-flowed -------- */

.course-grid:has(> .sc-card) {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-6);
}

@media (min-width: 700px) {
  .course-grid:has(> .sc-card) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  .course-grid:has(> .sc-card) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-6) var(--sp-5); }
}

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

.sc-card {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  box-shadow: none;
  overflow: visible;
}
.sc-card:hover { transform: none; }

.sc-card-link {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  block-size: 100%;
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--radius-md);
}
.sc-card-link:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; }

.sc-card .sc-cover {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.sc-card .sc-cover > img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease);
}
.sc-card-link:hover .sc-cover > img { transform: scale(1.03); }
.sc-card-link:hover .sc-cover { border-color: var(--line-strong); }

/* No picture at all: a dark box with the seal and the first letter of the title. */
.sc-cover-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(223, 180, 73, 0.14), transparent 62%),
    var(--bg-2);
}
.sc-cover-empty .sc-seal {
  grid-area: 1 / 1;
  inline-size: 42%;
  max-inline-size: 150px;
  block-size: auto;
  opacity: 0.22;
}
.sc-initial {
  grid-area: 1 / 1;
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 9vw, 3.6rem);
  line-height: 1;
  color: var(--gold-2);
}

.sc-card .sc-body {
  display: grid;
  gap: 4px;
  padding: 0 2px;
}
.sc-card .sc-title {
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.45;
  font-weight: 600;
  color: var(--ink);
}
[lang="ckb"] .sc-card .sc-title { font-size: 1.2rem; line-height: 1.7; }
.sc-card .sc-meta { font-size: 0.86rem; color: var(--dim); }

/* The member's own progress through the course: a thin gold bar, then "2 of 5 watched". */
.sc-progress {
  display: block;
  block-size: 4px;
  margin-block: 4px 2px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  overflow: hidden;
}
.sc-progress > span { display: block; block-size: 100%; background: var(--gold); border-radius: inherit; }

/* ---- /courses ------------------------------------------------------------- */

.sc-page { padding-block: var(--sp-7) var(--sp-10); position: relative; z-index: 1; }
.sc-page-title {
  margin: 0 0 var(--sp-6);
  font-size: clamp(1.8rem, 6vw, 2.6rem);
}

/* ---- one course page ------------------------------------------------------ */

.sc-course { padding-block: var(--sp-5) var(--sp-10); }

.sc-back { margin: 0 0 var(--sp-3); font-size: 0.92rem; }
.sc-back a {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  min-block-size: var(--tap);
  color: var(--muted);
}
.sc-back a:hover { color: var(--gold-2); }
[dir="rtl"] .sc-back-arrow { display: inline-block; transform: scaleX(-1); }

.sc-course-head { display: grid; gap: var(--sp-4); max-inline-size: 46rem; margin-block-end: var(--sp-8); }
.sc-course-title { margin: 0; font-size: clamp(2rem, 7vw, 3.2rem); line-height: 1.2; }
[lang="ckb"] .sc-course-title { line-height: 1.5; }
.sc-course-text { margin: 0; }
.sc-course-text.prose > :first-child { margin-block-start: 0; }
.sc-course-text.prose > :last-child { margin-block-end: 0; }
.sc-course-meta { margin: 0; }
.sc-course-action { margin: var(--sp-2) 0 0; }
.sc-start { min-inline-size: 15rem; justify-content: center; gap: var(--sp-3); }
.sc-start > span[aria-hidden] { font-size: 0.8em; }

.sc-lessons-title { margin: 0 0 var(--sp-5); font-size: 1.35rem; }

/* The lessons: a grid of pictures with the title under each, the page itself scrolls. */
.sc-lessons {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--sp-6);
  margin: 0;
  padding: 0;
  list-style: none;
}
.sc-lessons > li { min-inline-size: 0; }
.sc-lessons > li.sc-module { grid-column: 1 / -1; }
.sc-lessons > li.sc-module .eyebrow { margin: var(--sp-3) 0 0; }

@media (min-width: 700px) {
  .sc-lessons { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-7) var(--sp-5); }
}
@media (min-width: 1100px) {
  .sc-lessons { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.sc-lessons .lesson-item.lesson-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  padding: 0;
  background: none;
  box-shadow: none;
}
.sc-lessons .lesson-item.lesson-row:hover { background: none; }
.sc-lessons .lesson-item.lesson-row > .lesson-thumb {
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}
.sc-lessons .lesson-item.lesson-row:hover > .lesson-thumb { border-color: var(--line-strong); }
.sc-lessons .lesson-row .lesson-text b {
  font-size: 1rem;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  padding-inline: 2px;
}
.sc-lessons .lesson-row .lesson-text small { padding-inline: 2px; }
.sc-lessons .lesson-row .lesson-dur { inset-inline-end: 8px; inset-block-end: 8px; font-size: 0.78rem; }
.sc-lessons .lesson-row.is-done .lesson-thumb img { opacity: 0.72; }

/* A lesson whose picture is missing: dark box with the seal (lists here and beside the player). */
.lesson-thumb .sc-thumb-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 45%, rgba(223, 180, 73, 0.12), transparent 62%),
    var(--bg-2);
}
.lesson-item.lesson-row .lesson-thumb .sc-thumb-empty img {
  position: static;
  inline-size: 28%;
  max-inline-size: 72px;
  block-size: auto;
  opacity: 0.25;
  object-fit: contain;
  aspect-ratio: auto;
}

/* ---- list beside the player: the course's own name as its heading -------- */

.sc-rail-head { margin: 0 0 var(--sp-3); font-weight: 600; font-size: 1rem; line-height: 1.5; }
.sc-rail-head a { color: var(--gold-2); }
.sc-rail-head a:hover { color: var(--ink); }
[lang="ckb"] .sc-rail-head { font-size: 1.05rem; }

.sc-lesson-nav { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-block-end: 0; }

/* The big play button: a play triangle points right in Kurdish too (pages.css mirrored it, so it read as "rewind"). */
[dir="rtl"] .player-start > span { transform: none; }

/* ---- lesson page: title + previous/next right under the player ------------
   Phone and tablet: player, then the title block, then this course's lessons.
   Computer: player and title block on the left, the list on the right over both. */

.player-layout > .sc-info { padding-block: var(--sp-5) var(--sp-7); min-inline-size: 0; }
.player-layout > .sc-info .display { font-size: clamp(1.5rem, 5.5vw, 2.3rem); line-height: 1.35; margin-block: var(--sp-2) var(--sp-3); }
[lang="ckb"] .player-layout > .sc-info .display { line-height: 1.6; }
.player-layout > .sc-info .eyebrow { margin: 0; }
.player-layout > .sc-info .lead { margin-block: 0 var(--sp-4); }

@media (min-width: 1100px) {
  .player-layout:has(> .sc-info) { grid-template-rows: auto 1fr; }
  /* Placed without :has(), so an older browser still gets player left, list right. */
  .player-layout > .player { grid-column: 1; grid-row: 1; }
  .player-layout > .lesson-rail { grid-column: 2; grid-row: 1 / span 2; }
  .player-layout > .sc-info { grid-column: 1; grid-row: 2; inline-size: auto; max-inline-size: 1080px; margin-inline: var(--sp-5); justify-self: stretch; padding-block-start: 0; }
}
