/* Secondary 1 (Grade 7): the level page, in the top bar's violet (SECONDARY_PLAN.md section 4).
   The chapters themselves are laid out by the site's own .index-table and .chapter rules. */
.S1-level__heading {
  font-family: "Voltaire", sans-serif;
  font-size: 34px;
  color: #993696;
  text-align: center;
  margin: 6px 0 4px;
}
.S1-level__more {
  clear: both;
  padding: 24px 15px 0;
  text-align: center;
  font-family: "Catamaran", sans-serif;
  font-size: 17px;
}
/* On a wide screen the chapters keep the places the floats of the Primary pages give them (rows of
   three, chapter 7 under 6, chapter 14 under 13), except that chapter 15 moves up under chapter 11:
   as a float it could not, and sat below chapter 14 with a gap above it. So each chapter's place is
   stated. A chapter after the 15th falls into the next free place. */
@media (min-width: 768px) {
  .index-table.S1-chapters {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
  .index-table.S1-chapters::before,
  .index-table.S1-chapters::after {
    content: none;
  }
  .S1-chapters > .chapter {
    float: none;
    width: auto;
  }
  .S1-chapters > .chapter:nth-child(1) { grid-column: 1; grid-row: 1; }
  .S1-chapters > .chapter:nth-child(2) { grid-column: 2; grid-row: 1; }
  .S1-chapters > .chapter:nth-child(3) { grid-column: 3; grid-row: 1; }
  .S1-chapters > .chapter:nth-child(4) { grid-column: 1; grid-row: 2 / 4; }
  .S1-chapters > .chapter:nth-child(5) { grid-column: 2; grid-row: 2 / 4; }
  .S1-chapters > .chapter:nth-child(6) { grid-column: 3; grid-row: 2; }
  .S1-chapters > .chapter:nth-child(7) { grid-column: 3; grid-row: 3; }
  .S1-chapters > .chapter:nth-child(8) { grid-column: 1; grid-row: 4; }
  .S1-chapters > .chapter:nth-child(9) { grid-column: 2; grid-row: 4; }
  .S1-chapters > .chapter:nth-child(10) { grid-column: 3; grid-row: 4; }
  .S1-chapters > .chapter:nth-child(11) { grid-column: 1; grid-row: 5; }
  .S1-chapters > .chapter:nth-child(12) { grid-column: 2; grid-row: 5 / 7; }
  .S1-chapters > .chapter:nth-child(13) { grid-column: 3; grid-row: 5; }
  .S1-chapters > .chapter:nth-child(14) { grid-column: 3; grid-row: 6; }
  .S1-chapters > .chapter:nth-child(15) { grid-column: 1; grid-row: 6; }
}

/* Each chapter has its own colour, as each topic of a Primary level page has (homecampus.css),
   taken in turn from this list of fifteen; Secondary 1's violet comes first. The colour is set once
   per chapter and used by its heading and its lessons. */
.chapter.S1 { --chapter-colour: #993696; }
.chapter.S1:nth-child(15n+1) { --chapter-colour: #993696; }
.chapter.S1:nth-child(15n+2) { --chapter-colour: #368ac1; }
.chapter.S1:nth-child(15n+3) { --chapter-colour: #e16414; }
.chapter.S1:nth-child(15n+4) { --chapter-colour: #047604; }
.chapter.S1:nth-child(15n+5) { --chapter-colour: #b2002e; }
.chapter.S1:nth-child(15n+6) { --chapter-colour: #3000a3; }
.chapter.S1:nth-child(15n+7) { --chapter-colour: #d35e9b; }
.chapter.S1:nth-child(15n+8) { --chapter-colour: #0e8a8a; }
.chapter.S1:nth-child(15n+9) { --chapter-colour: #a36ebd; }
.chapter.S1:nth-child(15n+10) { --chapter-colour: #b58500; }
.chapter.S1:nth-child(15n+11) { --chapter-colour: #6b8e23; }
.chapter.S1:nth-child(15n+12) { --chapter-colour: #9e005d; }
.chapter.S1:nth-child(15n+13) { --chapter-colour: #5d6d7e; }
.chapter.S1:nth-child(15n+14) { --chapter-colour: #1f5f99; }
.chapter.S1:nth-child(15n+0) { --chapter-colour: #ee1d99; }
.chapter.S1 .chapter__name {
  background-color: var(--chapter-colour);
  color: #fff;
}
.chapter.S1 .chapter__topic {
  color: var(--chapter-colour);
}
/* The filled highlight follows the pointer or the keyboard, not a click: a link that keeps the
   focus after a click (and after coming back to the page) is not left highlighted. */
.chapter.S1 .chapter__topic:hover,
.chapter.S1 .chapter__topic:focus-visible {
  color: #fff;
  background-color: var(--chapter-colour);
  text-decoration: none;
}
.chapter.S1 .chapter__topic:focus:not(:focus-visible) {
  outline: none;
  color: var(--chapter-colour);
  background-color: transparent;
  text-decoration: none;
}

/* The book's chapters that do not have their lessons here yet */
.S1-level__book {
  clear: both;
  max-width: 900px;
  margin: 0 auto;
  padding: 26px 15px 0;
  text-align: center;
  font-family: "Catamaran", sans-serif;
  font-size: 17px;
}
.S1-level__book-heading {
  font-family: "Voltaire", sans-serif;
  font-size: 24px;
  color: #993696;
  margin: 0 0 6px;
}
.S1-level__book-chapters a {
  display: inline-block;
  margin: 4px 5px;
  padding: 6px 14px;
  border: 2px solid #993696;
  border-radius: 20px;
  color: #7a2b78;
  background: #fbf3fb;
  text-decoration: none;
}
.S1-level__book-chapters a:hover,
.S1-level__book-chapters a:focus-visible {
  color: #fff;
  background: #993696;
}
.S1-level__more {
  padding-top: 14px;
}

/* A chapter's worksheets, once it has questions (Level.html) */
.chapter.S1 .chapter__more {
  display: block;
  padding: 6px 15px 8px;
  font-family: "Catamaran", sans-serif;
  font-weight: bold;
  color: var(--chapter-colour);
  text-decoration: underline;
}
