/* Instant Maths Ideas section */

/* ---- landing page: three volume cards ---- */
.imi-volumes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1.5rem;
  margin: 1.5rem 0 2rem;
}
.imi-volume-card {
  border: 1px solid #e3dcef;
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
  background: #fbfaff;
}
.imi-volume-card img { max-width: 150px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.imi-volume-card p { margin-bottom: .4rem; }
.imi-volume-card a { text-decoration: none; }
.imi-count { color: #6c757d; font-size: .9rem; }

.imi-volume-head { display: flow-root; margin-bottom: 1rem; }
.imi-volume-head img.imi-cover,
.imi-volume-head .quarto-figure { float: left; margin: 0 1.5rem 1rem 0; }
.imi-chapter-list ul { columns: 2 22rem; column-gap: 2rem; }
.imi-chapter-list li { break-inside: avoid; margin-bottom: .3rem; }
.imi-pdf-small { font-size: .85rem; }

/* ---- chapter pages ---- */
.imi-chapter-tools { margin-bottom: 1rem; }
.imi-toggle-all { margin: .25rem 0 1rem; }

.imi-task {
  position: relative;
  border-top: 1px solid #e9e4f2;
  padding: 1rem 0 .5rem 5rem;
  min-height: 3rem;
}
.imi-task .imi-task-number,
.imi-task h3.imi-task-number {
  font-size: 1.05rem;
  margin: 0;
  position: absolute;
  left: 0;
  top: 1rem;
  font-weight: 700;
  color: #593196;
}
.imi-task .callout { margin-top: .75rem; }
.imi-task img.imi-fig, .imi-task .quarto-figure img { max-width: 100%; height: auto; }
.imi-task table, .imi-intro table { width: auto; }
@media (max-width: 576px) {
  .imi-task { padding-left: 0; }
  .imi-task .imi-task-number,
  .imi-task h3.imi-task-number { position: static; display: block; margin-bottom: .25rem; }
}

/* ---- resource sheets ---- */
.imi-sheets {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.25rem;
}
.imi-sheet { text-align: center; font-size: .9rem; }
.imi-sheet img { border: 1px solid #ccc; max-width: 130px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.imi-sheet-title { display: block; font-weight: 600; margin-top: .35rem; }

/* ---- print: show every answer ---- */
@media print {
  .imi-answer .callout-collapse.collapse { display: block !important; height: auto !important; }
  .imi-toggle-all, .imi-chapter-tools { display: none; }
}

/* the sidebar header only holds an empty logo link (the navbar already has the logo) */
.sidebar-header .sidebar-logo-link { display: none; }

/* tables with merged cells (e.g. number pyramids) are written as HTML */
.imi-html-table table { border-collapse: collapse; margin: .5rem 0 1rem; width: auto; }
.imi-html-table td, .imi-html-table th { border: 1px solid #999; padding: .25rem .6rem; text-align: center; }
.imi-html-table td[data-empty] { border: none; }

/* ---- answer boxes in the site's purple ---- */
.imi-answer.callout { border-left-color: #593196 !important; border-color: #d9cdec; }
.imi-answer.callout.callout-style-default > .callout-header {
  background-color: #593196 !important;
  color: #fff;
  opacity: 1;
  font-size: 1rem;
}
.imi-answer .callout-header .callout-title-container { color: #fff; }
.imi-answer .callout-icon::before,
.imi-answer .callout-toggle::before { filter: brightness(0) invert(1); }
/* answers in the same size as the task text */
.imi-answer.callout.callout-style-default .callout-body { font-size: 1rem; }

/* links to resource sheets from inside the text */
a.imi-sheet-ref { font-weight: 500; }

/* tables with merged cells: no stray lines from the site's table styles */
.imi-html-table table, .imi-html-table thead, .imi-html-table tbody,
.imi-html-table tr, .imi-html-table th { border: none !important; }
.imi-html-table td:not([data-empty]) { border: 1px solid #999 !important; }
.imi-html-table td[data-empty] { border: none !important; }

/* staggered (difference-table) layouts and other plain alignment tables */
.imi-align table { border: none; width: auto; margin: .25rem 0 .75rem; }
.imi-align td { border: none !important; padding: .1rem .9rem .1rem 0; text-align: center; }

/* diagrams always sit on their own line, also inside tables */
img.imi-fig { display: block; margin: .6rem 0; max-width: 100%; height: auto; }
td img.imi-fig { margin: .25rem auto; }

/* ordinary tables from the book */
.imi-table table { width: auto; margin: .5rem 0 1rem; }
.imi-table td, .imi-table th { padding: .25rem .75rem; vertical-align: top; }

.imi-html-table, .imi-table, .imi-align { margin-bottom: 1rem; }

/* "Instant Maths Ideas" at the top of the sidebar: a heading for the whole section */
#quarto-sidebar .sidebar-menu-container > ul > li:first-child > .sidebar-item-container {
  padding-bottom: 0.4rem; margin-bottom: 0.4rem; border-bottom: 1px solid #d9cdec;
}
#quarto-sidebar .sidebar-menu-container > ul > li:first-child > .sidebar-item-container .menu-text {
  font-weight: 700; font-style: italic; font-size: 1.3rem; line-height: 1.25; color: #593196;
}
/* the whole section is always open, so its toggle arrow isn't needed */
#quarto-sidebar .sidebar-menu-container > ul > li:first-child > .sidebar-item-container .sidebar-item-toggle { display: none; }
#quarto-sidebar .sidebar-menu-container > ul > li:first-child > ul.depth1 { padding-left: 0; }

/* breadcrumbs above each page title: make the section name stand out */
.quarto-page-breadcrumbs .breadcrumb-item:first-child a { font-weight: 700; font-style: italic; color: #593196; }

/* Notes for the teacher: every bullet list tight, with no gaps between bullets */
#notes-for-the-teacher li > p { margin-top: 0; margin-bottom: 0; }
#notes-for-the-teacher li > p + p, #notes-for-the-teacher li > ul + p { margin-top: 0.4rem; }
#notes-for-the-teacher li > .imi-table, #notes-for-the-teacher li > .imi-html-table { margin: 0.4rem 0; }

/* a decimal point printed on the line between two columns (e.g. between U and t) */
td.imi-point-after { position: relative; }
td.imi-point-after::after {
  content: "\2022"; position: absolute; right: 0; top: 50%;
  transform: translate(50%, -50%); line-height: 1; font-weight: 700;
}
#notes-for-the-teacher li > ul { margin-bottom: 0; }
/* place-value tables with a decimal point on a column line: centre the digits so the point sits halfway */
.imi-table table:has(td.imi-point-after) td { text-align: center; }
.imi-table td.imi-point-after { padding-right: 0.9em; }
.imi-table td.imi-point-after + td { padding-left: 0.9em; }

/* tables with the borders drawn in the book: only those borders */
table.imi-bordered { width: auto; border-collapse: collapse; }
table.imi-bordered > :not(caption) > * { border-width: 0; }
table.imi-bordered > :not(caption) > * > * { border-bottom-width: 0; box-shadow: none; }
table.imi-bordered td, table.imi-bordered th { padding: 0.25rem 0.6rem; }
table.imi-bordered, table.imi-bordered > * { border: 0 !important; }
.imi-table table.imi-bordered { margin-bottom: 1rem; }

/* 1.12 BIDMAS: the list with a downward arrow beside it */
.imi-bidmas { display: flex; align-items: stretch; gap: 1rem; margin: 0.6rem 0 0.8rem 2rem; font-size: 1.1rem; }
.imi-bidmas-arrow { position: relative; width: 12px; }
.imi-bidmas-arrow::before { content: ""; position: absolute; left: 5px; top: 0.2rem; bottom: 10px; border-left: 2px solid currentColor; }
.imi-bidmas-arrow::after { content: ""; position: absolute; left: 0; bottom: 0; border-left: 6px solid transparent; border-right: 6px solid transparent; border-top: 11px solid currentColor; }
.imi-bidmas-list { text-align: center; line-height: 1.6; }
.imi-bidmas-list b { font-size: 1.25em; }
.imi-tree { display: block; margin: 0.4rem 0 0.6rem; font-family: inherit; }
/* empty boxes drawn in the book (e.g. 1.17.2's row of rectangles, Braille cells) need a size */
table.imi-bordered td:empty { min-width: 2.8em; width: 2.8em; height: 1.7em; }

/* sidebar: the volume headings bold, the chapters under them not */
#quarto-sidebar ul.depth1 > li.sidebar-item-section > .sidebar-item-container .menu-text { font-weight: 700; }
#quarto-sidebar ul.depth2 .menu-text, #quarto-sidebar ul.depth2 .sidebar-link.active .menu-text { font-weight: 400; }
#quarto-sidebar ul.depth2 .sidebar-link.active .menu-text { color: #593196; }

/* small grids of boxes with dots in them (e.g. the Braille letter in 3.4.1): equal square boxes, dot in the centre */
table.imi-boxes.imi-bordered td, table.imi-boxes.imi-bordered td:empty { width: 2.4em !important; min-width: 2.4em; max-width: 2.4em; height: 2.4em; padding: 0 !important; text-align: center; vertical-align: middle; line-height: 1; }
table.imi-boxes.imi-bordered td strong { font-size: 1.5em; }
