/* SLAIF Notes theme: presentation only, shared identically by the three
 * content repositories. Assets originate from the Pangolin/SLAIF MkDocs
 * theme. Keep asset URLs relative so each repository is self-contained.
 * No generated text, hidden lesson content, or changes to quiz semantics. */
@import url("assets/slaif/stylesheets/fonts.css");

:root {
  --slaif-paper: #fbfbf9;
  --slaif-ink: #16302e;
  --slaif-body: #23312f;
  --slaif-muted: #52635f;
  --slaif-teal: #1b86a7;
  --slaif-link: #12617a;
  --slaif-lime: #a3c93e;
  --slaif-mist: #c7dfe7;
  --slaif-leaf: #eef4dc;
  --slaif-line: #dce3d6;
  --slaif-header-height: 80px;
  --aside-width: 208px;
  --prose-width: 880px;
  --gap: 28px;
}

html { scroll-padding-top: calc(var(--slaif-header-height) + 24px); }
body {
  margin: 0;
  background: var(--slaif-paper);
  color: var(--slaif-body);
  font-family: "Roboto", system-ui, sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.7;
}
*, *::before, *::after { box-sizing: border-box; }
:is(a, button, input, textarea, select, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--slaif-link);
  outline-offset: 4px;
}
a, button { -webkit-tap-highlight-color: transparent; }
.min-h-screen:has(> header.main-header) { margin-top: 0; }

/* Keep the native home, chapter, collection, progress and user controls.
 * The logo is decorative; no link destination or accessible name changes. */
header.main-header {
  height: var(--slaif-header-height);
  padding: 10px 28px 10px 108px;
  color: var(--slaif-ink);
  background: url("assets/slaif/images/slaif-logo.svg") no-repeat 14px center / 84px auto, var(--slaif-paper);
  border-bottom: 1px solid var(--slaif-line);
  box-shadow: 0 3px 20px #16302e08;
  column-gap: 16px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  font-size: 14px;
}
header.main-header > div { min-width: 0; }
header.main-header > div:first-child > .flex:first-child { flex-shrink: 0; gap: 12px; align-items: center; }
header.main-header > div:first-child > .flex:nth-child(2) { flex: 1 1 0; min-width: 0; }
header.main-header > div:first-child > .flex:nth-child(2) > a:not(:has(svg)) { flex: 1; min-width: 0; }
header.main-header > div:last-child > div:has(> span) > span { flex: 1; overflow: hidden; }
header.main-header > div:last-child > div > span > a {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: "Roboto Condensed", "Roboto", sans-serif;
  font-weight: 700;
}
header.main-header a:has(> .home-icon) { flex-shrink: 0; }
header.main-header .page-title {
  display: block;
  max-width: min(44vw, 600px);
  color: var(--slaif-ink);
  font: 700 18px/1.3 "Roboto Condensed", "Roboto", sans-serif;
}
header.main-header .page-title a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
header.main-header :is(a, .home-icon) { color: var(--slaif-link); }
header.main-header a:hover { color: var(--slaif-ink); }
header.main-header a:has(> .home-icon) { display: inline-flex; align-items: center; min-height: 40px; padding: 4px; }
header.main-header .home-icon { fill: currentColor; opacity: 1; flex-shrink: 0; }
header.main-header > div:last-child > .flex:last-child { flex-shrink: 0; align-items: center; gap: 12px; }
.user-dropdown > svg { width: 28px; height: 28px; color: var(--slaif-link); }
header.main-header .dropdown-content {
  color: var(--slaif-body);
  background: #fff;
  border-color: var(--slaif-line);
  box-shadow: 0 12px 32px #16302e1a;
  border-radius: 12px;
  max-width: calc(100vw - 32px);
}
header.main-header .dropdown-content li:not(.danger):hover { background: var(--slaif-leaf); }

/* Comfortable book canvas, retaining the platform's side-note column. */
main.container {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: calc(var(--slaif-header-height) + 32px) 28px 0;
  border: 0;
  background: linear-gradient(180deg, #e8f2f4 0, #f2f6f1 340px, var(--slaif-paper) 640px);
}
main.container > :is(.collection, .book) {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto 64px !important;
  padding: 36px 40px 40px;
  border: 1px solid var(--slaif-line);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 6px 28px #16302e06;
  color: var(--slaif-body);
  min-width: 0;
}
main.container > .collection { max-width: 1100px; }
.prose {
  color: var(--slaif-body);
  font-size: 16px;
  line-height: 1.75;
  --tw-prose-body: var(--slaif-body);
  --tw-prose-headings: var(--slaif-ink);
  --tw-prose-links: var(--slaif-link);
  --tw-prose-bold: var(--slaif-ink);
}
:is(.prose, .collection) :is(p, li) { font-weight: 400; line-height: 1.75; }
:is(.prose, .collection) p { margin: 1em 0; }
:is(.prose, .collection) strong { font-weight: 700 !important; color: inherit; }
:is(.book, .collection, .chapter) :is(h1, h2, h3, h4, h5, h6) {
  font-family: "Roboto Condensed", "Roboto", sans-serif;
  color: var(--slaif-ink);
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
:is(.book, .collection) h1 { font-size: 34px; font-weight: 800; margin: 1.5em 0 .75em; }
:is(.book, .collection) h2 { font-size: 26px; margin: 1.7em 0 .65em; }
:is(.book, .collection) h3 { font-size: 21px; margin: 1.5em 0 .65em; }
:is(.book, .collection) h4 { font-size: 18px; }
main.container > :is(.book, .collection) > h1:first-of-type {
  margin: -36px -40px 28px;
  padding: 36px 132px 36px 40px;
  background: url("assets/slaif/images/illus-step-discover.svg") no-repeat right 32px center / 64px auto, var(--slaif-mist);
  border-radius: 19px 19px 0 0;
  border-bottom: 1px solid #accbd5;
  font-size: clamp(30px, 2.6vw, 40px);
  line-height: 1.16;
}
.book > p.subtitle { color: var(--slaif-muted); font-size: 18px; line-height: 1.6; margin: 0 0 28px; }
.book > p.subtitle:empty { display: none; }
.chapter h2.chapter-title {
  color: var(--slaif-ink);
  font: 700 29px/1.25 "Roboto Condensed", "Roboto", sans-serif;
  padding: 28px 0 0;
  margin: 32px 0 24px;
  border-top: 2px solid var(--slaif-line);
}
:is(.book, .collection) :target { scroll-margin-top: 18px; }
:is(.prose, .collection) a {
  color: var(--slaif-link);
  font-weight: 400 !important;
  text-decoration: underline;
  text-decoration-color: #12617a66;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}
:is(.prose, .collection) a:hover { text-decoration-color: currentColor; color: var(--slaif-ink); }
:is(.prose, .collection) :is(ul, ol) { padding-left: 1.5em; margin: 1em 0; }
:is(.prose, .collection) ol { list-style: decimal; }
:is(.prose, .collection) ul { list-style: disc; }
:is(.prose, .collection) li { padding-left: .2em; margin: .35em 0; }
:is(.prose, .collection) li::marker { color: var(--slaif-link); }
:is(.prose, .collection) blockquote {
  padding: 2px 20px;
  border-left: 4px solid var(--slaif-lime);
  border-radius: 0 10px 10px 0;
  background: #f5f8ef;
  color: #35514c;
  font-style: normal;
}

/* The existing collection links become cards, with no text or ordering edits. */
main .collection .book {
  margin: 16px 0;
  padding: 0;
  border: 1px solid var(--slaif-line);
  border-left: 4px solid var(--slaif-lime);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 2px 6px #16302e04;
  transition: background-color .15s, border-color .15s, box-shadow .15s;
}
main .collection .book:hover { background: #f6faf8; border-color: #a5c4bb; box-shadow: 0 4px 16px #16302e0a; }
main .collection .book > a { display: block; padding: 22px 24px; text-decoration: none; border-radius: 10px; }
main .collection .book h2 { margin: 0; color: var(--slaif-link); font-size: 23px; }
main .collection .book p { margin: 8px 0 0; color: var(--slaif-muted); font-size: 15px; line-height: 1.65; }

/* Menus keep the existing controls and destinations; no fading text. */
.header-content-index { padding: 8px; border-radius: 8px; color: var(--slaif-link); }
.header-content-index:hover { background: var(--slaif-leaf); }
/* Keep the hover menu open while crossing from its icon to the panel. */
.header-content-index:hover::after {
  content: "";
  position: fixed;
  left: 24px;
  top: calc(var(--slaif-header-height) / 2 + 12px);
  width: min(480px, calc(100vw - 48px));
  height: calc(var(--slaif-header-height) / 2 + 8px);
}
.header-content-index .content-index-at-header {
  display: none !important;
  position: absolute;
  top: calc(100% + 8px);
  left: 24px;
  width: min(480px, calc(100vw - 48px));
  max-width: none;
  max-height: calc(100dvh - var(--slaif-header-height) - 40px);
  overflow-y: auto;
  padding: 16px;
  opacity: 1;
  animation: none !important;
  transform: none;
  background: #fff;
  border: 1px solid var(--slaif-line);
  border-radius: 12px;
  box-shadow: 0 12px 32px #16302e1a;
}
.header-content-index:is(:hover, :focus-within) .content-index-at-header { display: block !important; opacity: 1; }
.content-index {
  position: static;
  display: block;
  width: 100%;
  margin: 24px 0;
  padding: 16px;
  background: #f6f9f3;
  border: 1px solid var(--slaif-line);
  border-radius: 12px;
  opacity: 1;
  transition: none;
}
.content-index.small { width: max-content; }
:is(.content-index, .header-content-index .content-index-at-header) :is(h2, a, .toolbar) { opacity: 1; transition: none; }
:is(.content-index, .header-content-index .content-index-at-header) h2 { color: var(--slaif-ink); font: 700 20px/1.3 "Roboto Condensed", sans-serif; margin: 0 0 12px; }
:is(.content-index, .header-content-index .content-index-at-header) ul { list-style: none; padding: 0; margin: 0; }
:is(.content-index, .header-content-index .content-index-at-header) li { padding: 0; margin: 0; }
:is(.content-index, .header-content-index .content-index-at-header) a {
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--slaif-link);
  text-decoration: none;
}
:is(.content-index, .header-content-index .content-index-at-header) a.active { animation: none; background: var(--slaif-leaf); box-shadow: inset 3px 0 var(--slaif-lime); color: #344a10; }
:is(.content-index, .header-content-index .content-index-at-header) a:hover { background: #edf4f3; }

/* Maintain code syntax colours and correctness/error colours in quizzes. */
.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--slaif-line);
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.6;
}
.prose :is(td, th) { padding: 12px 14px; border-color: var(--slaif-line); min-width: 90px; }
.prose th { color: #304b33; background: #edf3e1; font-weight: 700 !important; }
.prose tbody tr:nth-child(even) { background: #f8faf6; }
.prose code:not(pre code) { color: #233d41; background: #edf3f1; border-radius: 4px; padding: .12em .3em; overflow-wrap: anywhere; }
.expressive-code { min-width: 0; max-width: 100%; margin: 22px 0; --ec-brdCol: #dce3d6; --ec-brdRad: 10px; }
.expressive-code pre { font-size: 14px; line-height: 1.65; }
.expressive-code .copy button { min-width: 36px; min-height: 36px; }
.prose :is(details, .quiz-section) { border-radius: 10px; }
.prose details { margin: 20px 0; padding: 12px 16px; background: #f5f8f3; border: 1px solid var(--slaif-line); }
.prose summary { font-family: "Roboto Condensed", "Roboto", sans-serif; font-weight: 700; color: var(--slaif-ink); cursor: pointer; }
.quiz:not(.quiz-section .quiz), .quiz-section { box-shadow: none; border-radius: 10px; }
.quiz :is(button, input, textarea) { font: inherit; border-radius: 8px; }
.quiz button { padding: 10px 14px; line-height: 1.5; }
.quiz-question h3 { font-family: "Roboto Condensed", "Roboto", sans-serif; }
.next-book-link { display: inline-block; margin: 32px 0 8px; padding: 12px 20px; border: 1px solid #aac7d0; border-radius: 24px; background: #edf4f3; }

/* Side notes keep their native positioning calculations. */
div.float-aside {
  padding: 12px 14px;
  border-left: 3px solid var(--slaif-lime);
  border-radius: 0 8px 8px 0;
  background: #f5f8ef;
  color: #35514c;
  font-size: 14px;
  line-height: 1.65;
}
div.float-aside p { font-size: inherit; line-height: inherit; }
/* Book introductions have no reserved side-note column. */
main.container > .book > div.float-aside {
  position: static !important;
  top: auto !important;
  transform: none !important;
  width: auto;
  margin: 24px 0 !important;
}
.prose img, .collection img { max-width: 100%; height: auto; }
.book-cover-img { overflow: hidden; }
.flex-container, .right-column { min-width: 0; }

/* A purely decorative closing band; no pretend footer links or CSS text. */
main.container::after {
  content: "";
  display: block;
  height: 156px;
  margin: 0 -28px;
  border-radius: 40px 40px 0 0;
  background-color: var(--slaif-ink);
  background-image: url("assets/slaif/images/slaif-logo-white.svg"), url("assets/slaif/images/illus-step-progress.svg"), url("assets/slaif/images/illus-step-discover.svg");
  background-repeat: no-repeat;
  background-size: 82px auto, 40px auto, 62px auto;
  background-position: max(32px, calc((100vw - 1100px) / 2)) center, right 72px bottom 20px, right 128px bottom 20px;
}

@media (max-width: 1000px) {
  :root { --aside-width: 0px; --gap: 0px; --prose-width: 100%; }
  main.container { padding-left: 20px; padding-right: 20px; }
  main.container > :is(.collection, .book) { padding: 28px; }
  main.container > :is(.collection, .book) > h1:first-of-type { margin: -28px -28px 24px; padding: 28px 112px 28px 28px; background-position: right 24px center; background-size: 56px auto; }
  .right-column { width: 100%; }
  div.float-aside, [data-float-aside] + p, [data-float-aside] + div {
    position: static !important;
    top: auto !important;
    transform: none !important;
    width: 100% !important;
    margin: 20px 0 !important;
  }
  div.expanding-side-img-container { max-width: 100%; }
  div.expanding-side-img-container div.expanding-side-img {
    position: static !important;
    top: auto !important;
    transform: none !important;
    width: 100%;
    max-width: 420px;
    margin: 20px 0;
  }
  div.expanding-side-img-container div.expanding-side-img img { max-height: none; width: auto; max-width: 100%; }
  div.expanding-side-img-container div.expanding-side-img .children { display: block; -webkit-line-clamp: unset; overflow: visible; }
  .prose .full-width, .prose [data-width-max] + * img { width: 100%; max-width: 100%; margin-left: 0 !important; }
  main.container::after { margin-left: -20px; margin-right: -20px; }
}

@media (max-width: 900px) {
  :root { --slaif-header-height: 96px; }
  header.main-header {
    padding: 10px 16px 10px 78px;
    background-size: 60px auto;
    background-position: 6px center;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: 1fr 1fr;
    gap: 2px 12px;
    font-size: 12px;
  }
  header.main-header > div:first-child { grid-row: 2; grid-column: 1 / -1; justify-content: flex-start; gap: 8px; }
  header.main-header > div:nth-child(2) { grid-row: 1; grid-column: 1; justify-self: start; max-width: 100%; }
  header.main-header > div:nth-child(2):not(:has(.page-title)) { display: none; }
  header.main-header > div:last-child { grid-row: 1; grid-column: 2; }
  header.main-header:not(:has(.page-title)) > div:last-child { grid-column: 1 / -1; }
  header.main-header .page-title { font-size: 16px; max-width: 100%; }
  header.main-header > div:last-child > .flex:last-child { gap: 8px; }
  header.main-header > div:last-child > .flex:last-child > div:first-child { max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  header.main-header .home-icon { width: 20px; height: 20px; }
  header.main-header a:has(> .home-icon) { min-height: 32px; }
  .header-content-index { padding: 6px; }
  .header-content-index .content-index-at-header { left: 16px; width: calc(100vw - 32px); }
  .header-content-index:hover::after { left: 16px; width: calc(100vw - 32px); }
}

@media (max-width: 600px) {
  main.container { padding: calc(var(--slaif-header-height) + 20px) 12px 0; }
  main.container > :is(.book, .collection) { padding: 22px 20px 28px; border-radius: 14px; margin-bottom: 36px !important; }
  main.container > :is(.book, .collection) > h1:first-of-type {
    padding: 24px 20px;
    margin: -22px -20px 24px;
    border-radius: 13px 13px 0 0;
    font-size: 30px;
    background-image: none;
  }
  :is(.prose, .collection) { font-size: 16px; }
  :is(.book, .collection) h1 { font-size: 27px; }
  :is(.book, .collection) h2, .chapter h2.chapter-title { font-size: 25px; }
  :is(.book, .collection) h3 { font-size: 21px; }
  .book > p.subtitle { font-size: 16px; }
  main .collection .book > a { padding: 18px 16px; }
  main .collection .book h2 { font-size: 22px; }
  .prose :is(td, th) { padding: 10px; }
  .prose :is(ul, ol) { padding-left: 1.3em; }
  .prose .expressive-code, .prose .expressive-code pre > code { width: 100% !important; max-width: 100% !important; }
  .prose .expressive-code pre { overflow-x: auto; }
  .collection .book-cover-img, .book .book-cover-img { float: none; width: 100%; max-width: 260px; margin: 0 auto 24px; }
  main.container::after { height: 130px; margin-left: -12px; margin-right: -12px; border-radius: 24px 24px 0 0; background-size: 66px auto, 28px auto, 44px auto; background-position: 28px center, right 26px bottom 20px, right 68px bottom 20px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .content-index *, .content-index-at-header *, main .collection .book { animation: none !important; transition: none !important; }
}

@media print {
  header.main-header, main.container::after { display: none !important; }
  body, main.container { background: #fff; color: #000; }
  main.container { padding: 0; }
  main.container > :is(.book, .collection) { max-width: 100%; padding: 0; margin: 0 !important; border: 0; box-shadow: none; }
  main.container > :is(.book, .collection) > h1:first-of-type { padding: 0; margin: 0 0 24px; background: none; border: 0; }
  :root { --aside-width: 0px; --gap: 0px; --prose-width: 100%; }
  div.float-aside { position: static !important; transform: none !important; width: 100% !important; margin: 12px 0 !important; }
  .right-column { width: 100%; }
}
