/* Study Notes in the site's look (issue #390; site look stage 4, redesign/SITE_LOOK_PLAN.md 3.7).

   Loaded only with the new look (NEW_LOOK), after hc-ui.css and, on a note, after study-notes.css. Hand-written, not
   built: study-notes.css stays as notes_build/build-css.mjs writes it, and serves the switch-off look unchanged.
   Every rule is under .sn-page, which only StudyNotes/Index.html, StudyNotes/Note.html and Secondary1/Lesson.html
   (the Secondary lessons, since issue #394) carry; a lesson page is laid out as a note (.sn-notepage).

   The index pages use the grade page's own parts (front.css .gr-top, .gr-world, .gr-lessons; the home page's grade
   tiles .hm-grade); this file only fits them to the notes. A note keeps its own content (the Tailwind boxes inside are
   its structure); its type becomes the site's, its title band the grade's band, and the page round it the site's
   paper, crumb and buttons. Colours come from the tokens and data-grade (--hc-gc-*), never a hex value. */

/* ---- The index pages: /Study-Notes and /Study-Notes/Primary-N ---- */
.sn-index :is(h1, h2, h3) { margin: 0; }
.sn-index .gr-top { grid-template-columns: minmax(0, 1fr); }      /* no call-to-action box beside the title */
.sn-index .gr-crumb { flex-wrap: wrap; }
.sn-index .gr-lead { max-width: 60ch; }

/* the two grades, as the home page's grade tiles, across the page */
.sn-levels.hm-section { margin-top: 0; }
.sn-grades.hm-grades { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sn-grades .hm-grade__go svg { width: 18px; height: 18px; }
.sn-grades .hm-grade__go { display: inline-flex; align-items: center; gap: 4px; }

.sn-intro { margin: 0 0 var(--hc-s-5); max-width: 72ch; font-size: var(--hc-fs-md); color: var(--hc-ink-2); }

/* a grade's topics: a heading with the grade's mark, then the topic cards (grade page chapters) */
.sn-level + .sn-level, .sn-levels + .sn-level { margin-top: var(--hc-s-7); }
.sn-level__head .hm-h2 a { color: inherit; text-decoration: none; }
.sn-level__head .hm-h2::before { content: ""; display: inline-block; width: 6px; height: .85em; margin-right: 12px; border-radius: 3px;
  vertical-align: -.04em; background: var(--hc-gc); }
.sn-level__head .hc-btn svg { width: 16px; height: 16px; }

.sn-page .gr-world__head { grid-template-columns: 36px minmax(0, 1fr); cursor: default; }
.sn-page .gr-world__name { font-size: var(--hc-fs-lg); }
.sn-page .sn-notes a { grid-template-columns: minmax(0, 1fr); padding: 8px 6px; }
.sn-note__h { display: block; }
.sn-note__d { display: block; margin-top: 3px; font-size: var(--hc-fs-xs); font-weight: 600; line-height: 1.4; color: var(--hc-ink-2); }
@media (max-width: 640px) {
  .sn-grades.hm-grades { grid-template-columns: minmax(0, 1fr); }
  .sn-page .gr-world__head { grid-template-columns: 32px minmax(0, 1fr); cursor: default; }
  .sn-page .gr-world__name { font-size: var(--hc-fs-md); }
  .sn-level__head { align-items: center; }
}

/* ---- A note: /Study-Notes/Primary-N/Topic/Note ---- */
.sn-notepage .hc-note-page { max-width: 900px; margin: 0 auto; padding: 0; }
.sn-crumb { flex-wrap: wrap; margin: 0 0 var(--hc-s-3); }
.sn-crumb a:hover { color: var(--hc-gc-ink); }
.sn-crumb__here { color: var(--hc-ink-3); }

/* the site's type throughout the note; long division and other set-out working (<pre>) keeps its fixed-width type */
.sn-page .hc-note {
  --font-sans: var(--hc-font);
  --default-font-family: var(--hc-font);
  font-family: var(--hc-font);
  color: var(--hc-ink);
}
.sn-page .hc-note .font-sans { font-family: var(--hc-font); }
.sn-page .hc-note .font-mono { font-family: var(--hc-font); font-variant-numeric: tabular-nums; }
.sn-page .hc-note :is(h1, h2, h3, h4) { letter-spacing: -.01em; }

/* the note's own box becomes the site's paper card */
.sn-page .hc-note > div:first-child {
  overflow-x: auto;     /* a note drawn wider than a phone (P5 Decimals word problems' bar model) scrolls inside the card, never the page */
  min-height: 0;
  background: var(--hc-paper);
  border: 1px solid var(--hc-paper-line);
  border-radius: var(--hc-r-lg);
  box-shadow: var(--hc-e-2);
}

/* its title band: the grade's band (as a grade page's head), not a colour picked per note */
.sn-page .hc-note > div:first-child > div:first-child {
  color: var(--hc-gc-on);
  background:
    radial-gradient(40% 90% at 100% 0%, color-mix(in srgb, var(--hc-gc) 70%, transparent) 0%, transparent 70%),
    linear-gradient(120deg, var(--hc-gc-band-1) 0%, var(--hc-gc-band-2) 100%);
  border-radius: var(--hc-r-lg);
}
.sn-page .hc-note > .min-h-screen > div:first-child { border-radius: 0; }     /* the band flush with the card's top */
.sn-page .hc-note > div:first-child > div:first-child h1 { color: inherit; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.sn-page .hc-note > div:first-child > div:first-child p { color: var(--hc-gc-on); }     /* solid: S2's .92 white is 4.3:1 under the band's glow */
/* the other form a Secondary lesson takes (125 of 211): a plain <header> (dark h1, grey line) in a wrapper with no
   background; it becomes the same band, and the wrapper gets the card's inside spacing */
.sn-page .hc-note > div:first-child:has(> header:first-child) { padding: var(--hc-s-5); }
.sn-page .hc-note > div:first-child > header:first-child {
  margin-bottom: var(--hc-s-6);
  padding: var(--hc-s-6);
  color: var(--hc-gc-on);
  background:
    radial-gradient(40% 90% at 100% 0%, color-mix(in srgb, var(--hc-gc) 70%, transparent) 0%, transparent 70%),
    linear-gradient(120deg, var(--hc-gc-band-1) 0%, var(--hc-gc-band-2) 100%);
  border-radius: var(--hc-r-lg);
}
.sn-page .hc-note > div:first-child > header:first-child h1 { color: inherit; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.sn-page .hc-note > div:first-child > header:first-child p { color: var(--hc-gc-on); }

/* ---- After the note: what next, as the site's buttons on a paper card with the grade's edge ---- */
.sn-after { margin-top: var(--hc-s-5); padding: var(--hc-s-5); border-top: 4px solid var(--hc-gc); }
.sn-after p { margin: 0 0 var(--hc-s-4); }
.sn-after p:last-child { margin-bottom: 0; }
.sn-after__go { display: flex; flex-wrap: wrap; gap: 10px; }
.sn-after .hc-btn { white-space: normal; text-align: left; line-height: 1.25; padding-top: 10px; padding-bottom: 10px; }
.sn-after .hc-btn svg { flex: none; }
.sn-after__turn { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sn-turn { display: block; padding: 12px 16px; border-radius: var(--hc-r-md); border: 1px solid var(--hc-paper-line); background: var(--hc-paper-2);
  font-weight: 750; line-height: 1.3; color: var(--hc-ink); text-decoration: none; }
.sn-turn small { display: block; margin-bottom: 2px; font-size: var(--hc-fs-xs); font-weight: 800; color: var(--hc-gc-ink); }
.sn-turn--prev small::before { content: "‹ "; }
.sn-turn--next small::after { content: " ›"; }
.sn-turn--next { grid-column: 2; text-align: right; }
.sn-turn:hover { border-color: var(--hc-gc); color: var(--hc-ink); text-decoration: none; }
.sn-after__join { padding: 12px 16px; border-radius: var(--hc-r-md); background: var(--hc-accent-soft); }
.sn-after__join a { font-weight: 800; }
.sn-after__made { font-size: var(--hc-fs-sm); color: var(--hc-ink-2); }
@media (max-width: 640px) {
  .sn-page .hc-note > :is(.p-6, div:first-child:has(> header:first-child)) { padding: var(--hc-s-4); }     /* the card's inside: more room for the text */
  .sn-page .hc-note > div:first-child > header:first-child { padding: var(--hc-s-5) var(--hc-s-4); margin-bottom: var(--hc-s-5); }
  .sn-after { padding: var(--hc-s-4); }
  .sn-after__turn { grid-template-columns: minmax(0, 1fr); }
  .sn-turn--next { grid-column: auto; }
  .sn-after__go .hc-btn { width: 100%; justify-content: flex-start; }
}

@media print {
  .sn-page .hc-note > div:first-child { box-shadow: none; border: 0; }
  .sn-after { display: none; }
}
