/* themes/oregonhealing/css/learn-study-guide.css
   The study-guide pages (/learn/study-guide and each guide's own page),
   linked after learn.css by learn_study_guide_head_extra(). Owns the .sg-*
   layout: the body shares the content hero's full container width and its
   left line, so headings, cards and sections all start where the header's
   logo does. The index is a grid of guide cards; a guide page is its section
   list, then numbered sections with room for a figure beside each. Colour
   and type come from the .lrn tokens, so a theme that re-points them
   (themes/alder/css/alder-learn.css) restyles this too. Mobile first:
   written for 390px, widened at 640px and 921px. Every link and button is
   at least 44px tall. */

.sg-wrap { width: min(100% - 32px, 1280px); margin: 0 auto; padding: 4px 0 72px; overflow-x: clip; }
.sg-k { margin: 0 0 6px; font-size: .8125rem; font-weight: 500; line-height: 1.3; letter-spacing: .06em; text-transform: uppercase; color: var(--lrn-muted); }
.sg-h2 { margin: 0 0 20px; font: 700 clamp(1.5rem, 2.8vw, 2rem)/1.1 var(--lrn-display); color: var(--lrn-ink); }
.sg-overview { max-width: 66ch; margin-bottom: 48px; }
.sg-btn {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: 999px;
  background: var(--lrn-green); color: #fff; font-weight: 600; font-size: .9375rem; text-decoration: none;
}
.sg-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--lrn-green); font-weight: 600; font-size: .9375rem; text-decoration: none; }
.sg-link svg { width: 18px; height: 18px; }
.sg a:focus-visible { outline: 2px solid var(--lrn-accent); outline-offset: 2px; }

/* Index: a group per module, a grid of guide cards */
.sg-group + .sg-group { margin-top: 48px; }
.sg-group__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 16px; margin: 0 0 14px; }
.sg-group__h { margin: 0; font: 700 1.375rem/1.15 var(--lrn-display); color: var(--lrn-ink); }
.sg-group__h a { display: inline-flex; align-items: center; min-height: 44px; color: inherit; text-decoration: none; }
.sg-group__n { margin: 0; color: var(--lrn-muted); font-size: .9375rem; }
.sg-cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.sg-card {
  display: flex; flex-direction: column; gap: 14px; min-width: 0;
  padding: 18px 18px 20px; border-radius: 16px; background: var(--lrn-cream);
}
.sg-card__fig { width: min(100%, 220px); margin: 0; }
.sg-card__fig:empty { display: none; }
.sg-card__text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.sg-card__h { margin: 0 0 8px; font: 700 1.25rem/1.25 var(--lrn-display); color: var(--lrn-ink); text-wrap: balance; }
.sg-card__h a { color: inherit; text-decoration: none; }
.sg-card__sum { margin: 0 0 14px; color: var(--lrn-body); font-size: .9375rem; line-height: 1.6; }
.sg-card__links { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; margin: auto 0 0; padding-top: 4px; }

/* Guide and quiz pages: the hero's "Read the lesson" and "Take the quiz" are inline
   text (17px tall), so each gets a 44px row to press. The negative margin
   gives the row's extra height back to the line, so the text sits where it
   did and the rows reach into the space above and below. */
:is(.sg, .qz) :is(.al-chead__meta, .ocd-page-hero__meta) a { display: inline-flex; align-items: center; min-height: 44px; margin: -11px 0; }

/* Guide page: the figure and the section list under the hero, then the numbered sections */
.sg-top { display: grid; grid-template-areas: "fig" "toc"; gap: 20px; margin: 0 0 12px; }
.sg-fig { grid-area: fig; width: min(100%, 260px); }
.sg-fig:empty { display: none; }
.sg-toc { grid-area: toc; min-width: 0; max-width: 40rem; }
.sg-toc ol { list-style: none; margin: 0; padding: 0; }
.sg-toc li a {
  display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 0;
  border-top: 1px solid var(--lrn-line); color: var(--lrn-ink); text-decoration: none; line-height: 1.35;
}
.sg-toc li:last-child a { border-bottom: 1px solid var(--lrn-line); }
.sg-sec__n { flex: none; min-width: 1.4em; font: italic 400 .9375rem/1 var(--lrn-display); color: var(--lrn-muted); }
.sg-sec { display: grid; grid-template-areas: "head" "fig" "body"; gap: 0 56px; padding: 28px 0 10px; border-top: 1px solid var(--lrn-line); scroll-margin-top: 96px; }
.sg-sec--intro { border-top: 0; padding-top: 8px; }
.sg-sec__h { grid-area: head; display: flex; align-items: baseline; gap: 12px; margin: 0 0 14px; font: 700 1.3rem/1.2 var(--lrn-display); color: var(--lrn-ink); text-wrap: balance; }
.sg-sec__body { grid-area: body; min-width: 0; }
.sg-sec__fig { grid-area: fig; width: min(100%, 220px); margin: 0 0 16px; }
.sg-sec__fig:empty { display: none; }
/* The reading measure: about 75 real characters a line. In rem, not ch: a
   ch is the zero's width in whatever face loaded, so if the webfont falls
   back the line grows past 75; 33.5rem holds it in either face. The section
   itself stays full width on the logo line; only the text line is capped. */
.sg-sec .ocd-prose { max-width: 33.5rem; }
/* A wide table scrolls sideways inside its measure instead of pushing the
   page. As a block it must shrink to its rows (fit-content), or the header
   tint stops where the columns end and the box runs on. */
.sg-sec .ocd-prose table { display: block; width: fit-content; max-width: 100%; overflow-x: auto; }
.sg-back { margin: 36px 0 0; }
.sg-back a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--lrn-green); font-weight: 600; text-decoration: none; }
.sg-back a svg { width: 18px; height: 18px; }

/* Attached documents: a thumbnail of the first page, the name in plain words, type and size */
.sg-docs { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 8px; }
.sg-doc__link {
  display: grid; grid-template-columns: 48px minmax(0, 1fr); gap: 12px; align-items: center;
  min-height: 44px; padding: 6px 12px 6px 6px; border: 1px solid var(--lrn-line); border-radius: 12px;
  background: #fff; color: inherit; text-decoration: none;
}
.sg-doc__thumb {
  display: flex; align-items: center; justify-content: center; width: 48px; height: 62px;
  border-radius: 4px; overflow: hidden; background: var(--lrn-tint); box-shadow: 0 0 0 1px var(--lrn-line);
}
.sg-doc__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.sg-doc__thumb svg { width: 22px; height: 22px; color: var(--lrn-green); }
.sg-doc__name { display: block; font-weight: 600; font-size: .9375rem; color: var(--lrn-ink); line-height: 1.35; }
.sg-doc__meta { display: block; margin-top: 2px; font-size: .8125rem; color: var(--lrn-muted); }

@media (hover: hover) {
  .sg-card__h a:hover, .sg-toc li a:hover, .sg-group__h a:hover { text-decoration: underline; text-decoration-color: var(--lrn-line); text-underline-offset: 3px; }
  .sg-link:hover, .sg-back a:hover { color: var(--lrn-ink); text-decoration: underline; text-decoration-color: currentColor; text-underline-offset: 3px; }
  .sg-btn:hover { background: var(--lrn-ink); }
  .sg-doc__link:hover { border-color: var(--lrn-green); }
}

@media (min-width: 640px) {
  .sg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .sg-card { padding: 22px 22px 24px; }
}

@media (min-width: 921px) {
  .sg-wrap { padding-bottom: 96px; }
  .sg-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
  .sg-card__fig { width: min(100%, 250px); }
  .sg-top { grid-template-columns: minmax(0, 40rem) minmax(0, 1fr); grid-template-areas: "toc fig"; column-gap: 56px; align-items: start; }
  .sg-fig { width: 100%; max-width: 320px; }
  .sg-sec { grid-template-columns: minmax(0, 56ch) minmax(0, 1fr); grid-template-areas: "head head" "body fig"; align-items: start; }
  .sg-sec__fig { width: 100%; max-width: 280px; margin: 0; }
  .sg-sec__h { font-size: 1.5rem; }
}

/* Guide page: the lesson's documents between the section list and the first section */
.sg-attach { margin: 8px 0 28px; }
.sg-attach .sg-docs { margin: 0; }
@media (min-width: 640px) {
  .sg-attach .sg-docs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 56rem; }
}
