@font-face {
  font-family: Tajawal;
  src: url("assets/Tajawal-Medium.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: Tajawal;
  src: url("assets/Tajawal-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Tajawal;
  src: url("assets/Tajawal-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: Tajawal;
  src: url("assets/Tajawal-ExtraBold.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

.material-edition {
  --arabic: Tajawal, Arial, sans-serif;
  --ink: #283548;
  --chapter-blue: #345fc8;
  --chapter-line: #dce5fa;
  --chapter-pale: #edf2fc;
  --chapter-gold: #ffc533;
  --muted: #526581;
  background: #eff3fa;
}
.material-edition .brand-icon { background: #e5edff; color: var(--chapter-blue); }
.material-edition .site-bar a.print-button {
  background: var(--chapter-blue);
  color: #fff;
  text-decoration: none;
}
.material-edition .site-bar a.print-button:hover { background: #224eac; }
.material-print-actions { display: flex; align-items: center; gap: .5rem; }
.material-answer-switch {
  padding: 7px 11px;
  border: 1px solid var(--chapter-line);
  border-radius: 9px;
  color: #244ba9;
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.material-answer-switch:hover { background: var(--chapter-pale); text-decoration: underline; }
@media screen and (max-width: 480px) {
  .material-edition .site-bar:has(.material-print-actions) {
    flex-wrap: wrap;
    gap: 4px 10px;
    padding-block: 8px;
  }
  .material-print-actions { margin-inline-start: auto; }
}
.material-sidebar { max-height: calc(100vh - 115px); overflow-y: auto; scrollbar-width: thin; padding-inline: 1px; }
.material-sidebar .contents a { min-height: 37px; line-height: 1.35; }
.material-sidebar .contents a[aria-current] { background: #eaf0ff; color: #244baf; }
.material-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; }
.material-links a {
  padding: 7px 10px;
  border: 1px solid var(--chapter-line);
  border-radius: 7px;
  background: #fff;
  color: #244baf;
  font-size: .85rem;
  font-weight: 700;
  text-decoration: none;
}
.material-links a:hover { background: var(--chapter-pale); text-decoration: underline; }

/* The two frame edges are the artwork from the first chapter. */
.material-sheet {
  --frame-point: 1pt;
  --frame-top: calc(61.423 * var(--frame-point));
  --frame-bottom: calc(62.152 * var(--frame-point));
  position: relative;
  padding: calc(78.52 * var(--frame-point)) 6.666667% calc(65.2 * var(--frame-point));
  border: 0;
  background:
    url("assets/paper-header.svg") center top / 100% var(--frame-top) no-repeat,
    url("assets/paper-footer.svg") center bottom / 100% var(--frame-bottom) no-repeat,
    #fff url("assets/paper-grid.png") left top / calc(24 * var(--frame-point)) repeat;
}
.material-sheet::before {
  position: absolute;
  top: var(--frame-top);
  bottom: var(--frame-bottom);
  left: 3.112%;
  right: 3.218%;
  border: solid #d8e3fa;
  border-width: 0 calc(.749 * var(--frame-point));
  content: "";
  pointer-events: none;
}
.material-header, .material-footer {
  position: absolute;
  left: 0;
  right: 0;
  font-family: Tajawal, sans-serif;
  font-weight: 700;
  line-height: 1.25;
}
.material-header { top: 0; height: var(--frame-top); color: #fff; }
.material-footer { bottom: 0; height: var(--frame-bottom); color: #47639a; }
.material-header > *, .material-footer > * { position: absolute; white-space: nowrap; }
.material-heading-instructor {
  top: calc(32.38 * var(--frame-point));
  right: 5.96%;
  font-size: calc(11.483 * var(--frame-point));
}
.material-heading-subject {
  top: calc(34.54 * var(--frame-point));
  left: 44.74%;
  font-size: calc(11.6 * var(--frame-point));
  font-weight: 800;
}
.material-heading-chapter {
  top: calc(32.02 * var(--frame-point));
  left: 5.855%;
  font-size: calc(10.981 * var(--frame-point));
}
.material-footer-grade {
  top: calc(11.39 * var(--frame-point));
  right: 6.77%;
  font-size: calc(11.483 * var(--frame-point));
}
.material-footer-chapter {
  top: calc(11.77 * var(--frame-point));
  left: 6.665%;
  font-size: calc(10.981 * var(--frame-point));
}
.material-footer-number {
  top: calc(8.24 * var(--frame-point));
  left: 50.01%;
  transform: translateX(-50%);
  width: calc(29.21 * var(--frame-point));
  height: calc(21.723 * var(--frame-point));
  border-radius: calc(11 * var(--frame-point));
  background: #547dec;
  color: #fff;
  font-family: Tajawal, sans-serif;
  font-size: calc(11.985 * var(--frame-point));
  line-height: calc(20.60 * var(--frame-point));
  text-align: center;
}

/* Chapter-one artwork, with selectable text positioned over its original grid. */
.material-intro {
  --intro-point: 1.333333px;
  position: relative;
  aspect-ratio: 515.73 / 191.4;
  background: url("assets/chapter-opening.svg") left top / 100% 100% no-repeat;
}
.material-chapter-title, .material-chapter-number {
  position: absolute;
  display: block;
  margin: 0;
  font: 800 calc(17.98 * var(--intro-point))/1 Tajawal, sans-serif;
  line-height: calc(38.95 * var(--intro-point));
  text-align: center;
}
.material-chapter-title {
  top: .46%;
  left: 62.02%;
  width: 28.90%;
  height: 20.35%;
  color: #fff;
}
.material-chapter-number {
  top: .26%;
  right: 0;
  width: 7.70%;
  height: 20.74%;
  color: var(--chapter-blue);
}
.material-chapter-subtitle {
  position: absolute;
  top: 25.03%;
  right: 12.11%;
  color: #70809b;
  font: 400 calc(8.99 * var(--intro-point))/1.25 Tajawal, sans-serif;
}
.material-intro-card {
  position: absolute;
  inset: 38.03% 0 3.63%;
}
.material-intro-card strong, .material-intro-card p {
  position: absolute;
  right: 3.05%;
  max-width: 70%;
}
.material-intro-card strong {
  top: 32.88%;
  color: var(--chapter-blue);
  font: 700 calc(9.74 * var(--intro-point))/1.25 Tajawal, sans-serif;
}
.material-intro-card p {
  top: 51.25%;
  font: 700 calc(14.23 * var(--intro-point))/1.25 Tajawal, sans-serif;
}
.material-intro-card img {
  position: absolute;
  bottom: 5%;
  left: 4.79%;
  width: 22%;
  height: 90%;
  object-fit: contain;
  object-position: center bottom;
}

.material-body {
  padding-bottom: .8em;
  color: #202e43;
  font-weight: 500;
  line-height: 1.64;
}
.material-body + .material-body { margin-top: 2.4mm; }
.material-body p, .material-body li {
  text-align: justify;
  text-align-last: right;
  overflow-wrap: break-word;
}
.material-body p { margin: .36em 0; orphans: 2; widows: 2; }
.material-intro + .material-body > h2:first-child { display: none; }
.material-intro-long + .material-body > h2:first-child { display: block; }
.material-intro-long .material-chapter-title {
  padding-inline: .2em;
  font-size: max(9px, calc(13 * var(--intro-point)));
}
.material-body h1, .material-body h2, .material-body h3, .material-body h4 {
  margin: .76em 0 .36em;
  line-height: 1.42;
  color: #244ba9;
  break-after: avoid;
}
.material-body h1, .material-body h2 {
  padding: .44em .65em .28em;
  border: 1px solid #d1ddfa;
  border-inline-start: 3px solid var(--chapter-gold);
  border-radius: 7px;
  background: #ebf0fc;
  font-size: 1.35em;
}
.material-body h3:not(.material-homework-title) {
  padding: .27em .53em .12em;
  border-inline-start: 2px solid #6a8ded;
  border-radius: 3px;
  background: #f3f6fd;
  font-size: 1.14em;
}
.material-body h4 { color: #345fc8; font-size: 1.03em; }
.material-body:where(:not(.exam-stack, .exam-single)) :is(h1, h2) {
  padding: .47em .72em .36em;
  border-color: #cbd9fb;
  border-inline-start-color: var(--chapter-gold);
  border-radius: 8px;
  background: #e9efff;
}
.material-body:where(:not(.exam-stack, .exam-single)) h3:not(.material-homework-title) {
  padding: .3em .62em .22em;
  border: 1px solid #d5e1fb;
  border-inline-start: 3px solid #6a8ded;
  border-radius: 6px;
  background: #eef3ff;
}
.material-body:where(:not(.exam-stack, .exam-single)) h4 { color: #3054a4; }
.material-body .material-problem, .material-body .material-solution { break-after: avoid; }
.material-writing-task { break-inside: avoid; }
.material-writing-space { height: calc(var(--writing-lines) * 1.26em); }
.material-practice { margin-block-end: .85em; break-inside: avoid; }
.material-practice-prompt {
  padding: .48em .65em .38em;
  border: 1px solid #bdcff8;
  border-radius: 7px;
  background: #f4f7fe;
}
.material-body .material-practice-prompt p { margin: 0; }
.material-numbered-prompt {
  display: flex;
  align-items: baseline;
}
.material-prompt-content { flex: 1; min-width: 0; }
.material-question-forms {
  display: block;
  margin-top: .35em;
  text-align: right;
  text-align-last: right;
  font-size: .94em;
}
.material-question-forms > strong { color: #25385c; }
.material-question-form { display: block; line-height: 1.55; }
.material-subpart-prompt {
  padding: .22em 0 .12em;
  border-block-start: 1px solid #e2e9f7;
}
.material-body .material-subpart-prompt p { margin: 0; }
.material-body .material-subpart-prompt .material-calculation {
  text-align: right;
  text-align-last: right;
}
.material-body .material-subpart {
  margin-top: .65em;
  padding-block-start: .18em;
  border-block-start: 1px solid #e2e9f7;
}
.material-part-label {
  color: #2e57b3;
  font-weight: 700;
  white-space: nowrap;
}
.material-numbered-prompt > .material-part-label { margin-left: .58em; }
.material-subpart > .material-part-label { margin-inline-end: .58em; }
.material-numbered-prompt > .material-problem-label { font-weight: 700; }
.material-practice-parts { list-style: none; }
.material-practice-parts bdi, .material-practice-part-label { color: #244ba9; font-weight: 700; }
.material-practice-part-label { margin-block-start: .25em; }
.material-practice .exam-display-equation { display: block; }
.material-practice .material-sum-table :is(th, td)[dir="ltr"] { direction: ltr; }
.material-practice .material-sum-table :is(th, td)[dir="rtl"] { direction: rtl; }
.material-body .material-problem {
  margin-top: .72em;
  padding: .40em .63em .27em;
  border: 1px solid #bdcff8;
  border-radius: 7px;
  background: #f4f7fe;
}
.material-problem-label {
  display: inline-block;
  margin-inline-end: .4em;
  padding: .11em .48em .02em;
  border-radius: 4px;
  background: #4b70dc;
  color: #fff;
  white-space: nowrap;
}
.material-exam-dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .3em;
  margin-top: .35em;
  color: #25385c;
  font-size: .76em;
  font-weight: 700;
  line-height: 1.22;
  break-inside: avoid;
}
.material-exam-label { padding-inline: .25em; color: #244ba9; }
.material-exam-dates .exam-occurrence {
  display: flex;
  align-items: center;
  gap: .42em;
  padding: .12em;
  border: 1px solid #dbb54e;
  border-radius: 5px;
  background: #fff1bf;
  white-space: nowrap;
}
.material-exam-dates .exam-round { padding-inline: .32em .16em; }
.material-exam-dates .exam-year {
  display: inline-block;
  padding: .19em .4em .12em;
  border-radius: 3px;
  background: #345fc8;
  color: #fff;
  font-size: 1.13em;
  line-height: 1.1;
}
.material-solution {
  break-inside: avoid;
}
.material-body .material-solution-heading,
.material-continuation :is(.material-solution-heading, .material-question-continuation) {
  margin: .6em 0 .24em;
  color: #244ba9;
  font-size: 1em;
  font-weight: 700;
  line-height: 1.38;
  text-align: right;
  break-after: avoid;
  bookmark-level: none;
}
.material-solution > .material-solution-heading + .material-problem {
  margin-top: 0;
}
.material-body .material-caption {
  margin-top: .12em;
  color: var(--muted);
  text-align: center;
  text-align-last: center;
  font-size: .9em;
}
.material-body :is(ol, ul) { margin: .3em 0; padding: 0; }
.material-body li { margin-inline-start: 1.42em; padding-inline-start: .08em; }
.material-body li::marker { color: var(--chapter-blue); font-weight: 700; }
.material-body .material-labeled-calculation { list-style-type: none; }
.material-body blockquote {
  margin: .55em 0;
  padding: .30em .75em;
  border: 1px solid #f4d58b;
  border-inline-start: 2px solid #eab439;
  border-radius: 7px;
  background: #fff6df;
}
.material-body blockquote > p > strong:first-child { color: #805704; }
.material-homework {
  margin: .58em 0;
  border: 1px solid #b9dbd7;
  border-radius: 9px;
  background: #edf7f5;
  break-inside: avoid;
}
.material-body .material-homework-title {
  display: flex;
  justify-content: space-between;
  margin: 0;
  padding: .52em .84em;
  border-radius: 8px 8px 0 0;
  color: #176266;
  background: #dcefed;
  font-size: .96em;
}
.material-homework-content { padding: .34em .84em .44em; }
.material-homework-row { padding: .4em 0; }
.material-homework-row + .material-homework-row,
.material-homework-content > ul > li + li {
  border-block-start: 1px solid #cde4e0;
}
.material-homework-content > ul > li { padding-block: .3em; }
.material-homework .material-subpart-prompt {
  border: 0;
  padding-block: .12em;
}
.material-homework .material-part-label,
.material-homework-content > ul > li > p > strong,
.material-homework-content li::marker {
  color: #176266;
}
.material-homework .material-writing-space { height: calc(var(--writing-lines) * .95em); }
.material-body table {
  width: 100%;
  border-collapse: collapse;
  margin: .44em 0;
  font-size: .88em;
  line-height: 1.54;
}
.material-body th, .material-body td {
  padding: .34em .45em;
  border: 1px solid #d7e2f7;
  text-align: start;
  vertical-align: middle;
}
.material-body th { color: #fff; background: #4264cd; }
.material-body th a { color: inherit; }
.material-body tbody tr:nth-child(even) { background: #f1f5fd; }
.material-body tr { break-inside: avoid; }
.material-body .material-sum-table :is(th, td) { text-align: center; }
.material-body .material-coordinate-table :is(th, td) {
  width: 1%;
  text-align: center;
}
.material-sum-table th:nth-child(-n+2), .material-sum-table td:first-child { direction: rtl; }
.material-body .katex-display { margin: .26em 0; }
.material-body .katex-display > .katex { white-space: normal; }
.material-body .katex-display .katex-html { line-height: 1.32; }
.material-body .katex .katex-base { overflow-wrap: normal; }
.material-body .katex .mord.text { font-family: var(--arabic); }
.material-solution-cue {
  padding: 0;
  background: #eaf0ff;
  color: #22478c;
  text-decoration: underline;
  text-decoration-color: #7f9ddc;
  text-underline-offset: .12em;
}
.material-key-equation .katex-html, .material-body .katex-html .munder {
  color: #244ba9;
}
.material-body .katex-html .material-result-term {
  color: #83410f;
}
.material-inline-math {
  direction: ltr;
  unicode-bidi: isolate;
}
.material-inline-math .katex, .material-formula .katex { direction: ltr; }
.material-body .katex { font-size: 1.055em; }
.material-body .material-formula .katex, .material-body .material-calculation .katex { font-size: 1.115em; }
.material-body .material-calculation, .material-formula {
  direction: ltr;
  text-align: left;
  text-align-last: left;
}
.material-body .material-calculation > p:not(.material-calculation) { direction: rtl; }
.material-formula {
  margin: .25em 0;
  padding: .07em .36em;
  break-inside: avoid;
  overflow: auto;
}
.material-formula .katex-display > .katex { text-align: left; }
.conics-solution {
  padding-inline: .12em;
}
.conics-solution .material-formula {
  margin-block: .28em;
  padding-inline: 0;
}
.conics-solution .material-diagram { margin-block: .48em; }
.material-diagram {
  margin: .55em auto;
  text-align: center;
  break-inside: avoid;
}
.material-diagram img {
  display: inline-block;
  width: auto;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
  border: 1px solid var(--chapter-line);
  border-radius: 7px;
}
.material-diagram-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 .95em;
  margin-top: .2em;
  color: #334963;
  font-size: .79em;
  line-height: 1.42;
}
.material-diagram-key bdi { color: #2453a6; font-weight: 700; }
.material-quote {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin: .95em 0 0;
  padding: .8em 1.05em;
  border: 1px solid #cbd8f2;
  border-radius: 8px;
  background: #f3f6fd;
  color: #243a5c;
  font-size: 1.025rem;
  line-height: 1.5;
  break-inside: avoid;
}
.material-quote::before {
  position: absolute;
  top: -1px;
  right: 1em;
  width: 1.55em;
  height: 2px;
  border-radius: 2px;
  background: var(--chapter-gold);
  content: "";
}
.material-quote-illustrated {
  min-height: 7em;
  padding-left: 7.05em;
}
.material-quote-artwork {
  position: absolute;
  bottom: .28em;
  left: .55em;
  width: 5.95em;
  height: 6.4em;
  object-fit: contain;
  object-position: center bottom;
}
.material-quote-illustration { object-position: center; }
.material-quote blockquote { margin: 0; }
.material-quote p { margin: 0; font-weight: 700; }
.material-quote figcaption {
  margin-top: .68em;
  color: var(--muted);
  font-size: .84em;
  line-height: 1.35;
}
.material-quote figcaption strong { color: #2955b5; }
.material-quote cite { display: block; margin-top: .1em; font-size: .94em; font-style: normal; }

@media screen {
  .material-edition .document { container-type: inline-size; }
  .material-sheet {
    --frame-point: calc(100cqi / 594.96);
    min-height: calc(841.92 * var(--frame-point));
  }
  .material-body {
    padding-bottom: 0;
    font-size: max(.9rem, calc(11.8 * var(--frame-point)));
  }
  .material-intro { --intro-point: calc(100cqi * .86666667 / 515.73); }
}
@media screen and (max-width: 820px) {
  .material-sidebar { max-height: none; overflow: visible; }
}
@media screen and (max-width: 600px) {
  .material-chapter-subtitle, .material-intro-card strong { font-size: max(9px, calc(9.5 * var(--intro-point))); }
  .material-intro-card p { font-size: max(10px, calc(14.23 * var(--intro-point))); }
  .material-body table { display: block; overflow-x: auto; }
  .material-body .katex { font-size: 1em; }
  .material-quote-illustrated { min-height: 6.15em; padding-left: 5.5em; }
  .material-quote-artwork { left: .3em; width: 4.8em; height: 5.45em; }
}

@page material { size: A4 portrait; margin: 0; }
@media print {
  .material-document, .material-edition { background: transparent; }
  .material-edition { color: #283548; }
  .material-sheet {
    page: material;
    display: block;
    width: 210mm;
    height: 297mm;
    margin: 0;
    box-shadow: none;
    break-after: page;
  }
  .material-sheet:last-child { break-after: auto; }
  .material-intro { --intro-point: 1pt; height: 191.4pt; break-inside: avoid; }
  .material-intro + .material-body > h2:first-child + h3 { margin-top: 0; }
  .material-body { padding-bottom: 0; font-size: 11.8pt; line-height: 1.62; }
  .material-body ol[start] > li[data-list-label] {
    position: relative;
    list-style-type: none;
  }
  .material-body ol[start] > li[data-list-label]::before {
    position: absolute;
    top: 0;
    left: 100%;
    margin-left: .3em;
    direction: ltr;
    color: var(--chapter-blue);
    font-weight: 700;
    content: attr(data-list-label);
  }
  .material-body ol[start] > li[data-list-label][dir="ltr"]::before {
    right: 100%;
    left: auto;
    margin: 0 .3em 0 0;
  }
  .material-quote { font-size: 11.7pt; }
  .material-body > * { break-inside: avoid; }
  .material-body .katex-display .katex-html { line-height: 1.22; }
  .material-body .katex-mathml { display: none; }
  .material-formula { overflow: visible; }
  .material-diagram img { max-height: 52mm; }
}
