/* Course shell. Lesson pages load this after site.css. */

:root {
  --instructor-bar-height: 3.5rem;
}

[hidden] {
  display: none !important;
}

.skip {
  z-index: 80;
}

.skip:focus,
.skip:focus-visible {
  top: 0.75rem;
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.course-app :focus-visible,
.instructor-footer :focus-visible,
#embed-dialog :focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.lesson-card,
.canvas-root {
  overflow-x: clip;
}

.katex-display,
mjx-container[display="true"] {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-block: 0.25rem;
}

.katex .katex-mathml {
  position: absolute;
  clip: rect(1px, 1px, 1px, 1px);
  padding: 0;
  border: 0;
  height: 1px;
  width: 1px;
  overflow: hidden;
}

.embed-brand {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  box-sizing: border-box;
  min-height: 38px;
  margin: 0;
  padding: 0 0.85rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  color: var(--text);
  cursor: default;
}

.embed-brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 0;
  cursor: default;
}

.embed-mark {
  display: block;
  flex: 0 0 auto;
  line-height: 0;
}

.embed-mark img {
  display: block;
  width: 1.65rem;
  height: 1.65rem;
}

.embed-wordmark {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.06rem;
  min-width: 0;
  font-family: var(--sans);
  line-height: 1;
  cursor: default;
}

.embed-wordmark-name {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: -0.012em;
}

.embed-wordmark-commons {
  color: #867875;
  font-size: 0.48rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

@media (prefers-color-scheme: dark) {
  .embed-wordmark-commons {
    color: #b8aaa6;
  }
}

html[data-embed="lesson"] .embed-brand,
html[data-embed="course"] .embed-brand {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 30;
}

html[data-embed="full"][data-newtab="1"] .embed-brand {
  display: flex;
  justify-content: flex-end;
  min-height: 0;
  padding: 0.55rem 1rem 0;
  border-bottom: 0;
  background: transparent;
}

html[data-embed="full"] .embed-brand-lockup {
  display: none;
}

html[data-embed="course"] .course-bar {
  top: 38px;
}

.open-newtab {
  display: none;
}

html[data-newtab="1"] .embed-brand .open-newtab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 30px;
  min-width: 44px;
  margin: 0;
  padding: 0.2rem 0.7rem;
  border: 2px solid var(--btn-bg);
  border-radius: 0.4rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 600;
  font-size: 0.88rem;
  line-height: 1.2;
  text-decoration: none;
}

html[data-newtab="1"] .embed-brand .open-newtab:hover {
  background: var(--btn-hover);
  border-color: var(--btn-hover);
  color: var(--btn-text);
}

.embed-credit {
  display: none;
  margin: 1.35rem 0 0.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

html[data-embed="lesson"] .embed-credit,
html[data-embed="course"] .embed-credit {
  display: block;
}

html[data-embed="lesson"] a[href^="http"]:not(.open-newtab):not(.alkimi-newtab),
html[data-embed="course"] a[href^="http"]:not(.open-newtab):not(.alkimi-newtab),
html[data-embed="lesson"] a[href^="//"]:not(.open-newtab):not(.alkimi-newtab),
html[data-embed="course"] a[href^="//"]:not(.open-newtab):not(.alkimi-newtab) {
  color: inherit;
  cursor: default;
  pointer-events: none;
  text-decoration: none;
}

.course-app {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  padding-bottom: 0;
}

html[data-embed="full"] .course-app {
  padding-top: 1.5rem;
}

html:not([data-embed]) body {
  padding-bottom: calc(var(--instructor-bar-height) + env(safe-area-inset-bottom, 0px));
}

.course-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 24;
  min-height: 44px;
  padding: 0.35rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
}

.contents-btn,
.outline-toggle,
.drawer-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 0.45rem;
  background: var(--card);
  color: var(--text);
  font: 600 0.95rem/1.2 var(--sans);
  cursor: pointer;
}

.contents-btn:hover,
.outline-toggle:hover,
.drawer-close:hover {
  background: var(--hover);
  color: var(--text);
}

.course-frame {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  width: min(88rem, calc(100% - 1.5rem));
  margin: 0.75rem auto 0;
}

.course-main {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.course-main > .site-footer {
  margin-top: auto;
  padding: 1.15rem 0 0.15rem;
}

.course-main .footer-inner {
  width: auto;
  max-width: none;
  margin: 0;
}

.course-sidebar {
  position: fixed;
  z-index: 40;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(22rem, calc(100vw - 3rem));
  overflow: hidden;
  transform: translateX(-105%);
  border-right: 1px solid var(--rule);
  background: var(--card);
  color: var(--text);
}

@media (max-width: 900px) and (min-height: 551px) {
  html:not([data-embed]) .course-sidebar,
  html[data-embed="full"] .course-sidebar {
    top: var(--site-header-height);
  }

  html[data-embed="course"] .course-sidebar {
    top: 38px;
  }
}

.sidebar-clip,
.sidebar-clip-inner {
  height: 100%;
}

.sidebar-clip-inner {
  overflow: auto;
  padding: 0.75rem;
}

.course-sidebar.is-open {
  transform: translateX(0);
}

.sidebar-clip[data-concealed] {
  visibility: hidden;
}

@media (max-width: 900px) {
  .course-sidebar:not(.is-open) {
    pointer-events: none;
  }
}

.drawer-backdrop {
  position: fixed;
  z-index: 30;
  inset: 0;
  background: rgba(11, 19, 32, 0.62);
}

.drawer-close {
  margin-bottom: 0.75rem;
}

.outline-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  position: absolute;
  z-index: 5;
  top: 1.35rem;
  left: 100%;
  width: 28px;
  min-width: 28px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--rule);
  border-left: 0;
  border-radius: 0 8px 8px 0;
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: 2px 1px 8px rgba(11, 19, 32, 0.12);
}

.outline-toggle svg {
  display: block;
  transition: transform 0.22s ease;
}

html[data-outline="closed"] .outline-toggle svg {
  transform: rotate(180deg);
}

.outline-toggle:hover {
  background: var(--hover);
  color: var(--text);
}

.outline-panel {
  min-width: 0;
}

.unit-field {
  margin: 0 -0.75rem 1.15rem;
  padding: 0.1rem 0.75rem 1.05rem;
  border-bottom: 1px solid var(--rule);
}

.unit-field label {
  display: block;
  margin: 0 0 0.4rem;
  color: var(--link);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.unit-select-wrap {
  position: relative;
  margin: 0;
}

.unit-select-display {
  display: block;
  min-height: 44px;
  padding: 0.5rem 2.45rem 0.5rem 0.7rem;
  border: 2px solid #18608f;
  border-radius: 0.5rem;
  background-color: #e7f2f8;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16'%3E%3Cpath d='M3 6.15 7 2.35 11 6.15M3 9.85 7 13.65 11 9.85' fill='none' stroke='%2318608f' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.65rem center;
  background-size: 0.85rem 1rem;
  color: #1e3557;
  font: 600 0.95rem/1.35 var(--sans);
}

.unit-select-wrap:hover .unit-select-display {
  border-color: #1e3557;
  background-color: #d5e7f4;
}

.unit-select-wrap select {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.unit-select-wrap:focus-within .unit-select-display {
  border-color: #1e3557;
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

@media (prefers-color-scheme: dark) {
  .unit-select-display {
    border-color: #4da6e8;
    background-color: #16344f;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16'%3E%3Cpath d='M3 6.15 7 2.35 11 6.15M3 9.85 7 13.65 11 9.85' fill='none' stroke='%23f1f5f9' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    color: #f1f5f9;
  }

  .unit-select-wrap:hover .unit-select-display,
  .unit-select-wrap:focus-within .unit-select-display {
    border-color: #f0b43c;
    background-color: #1c466c;
  }
}

#outline-nav {
  display: flex;
  flex-direction: column;
}

.topic-block + .topic-block {
  margin-top: 0;
  border-top: 1px solid color-mix(in srgb, var(--line) 65%, transparent);
}

.topic-block[open] {
  margin: 0.35rem 0;
  padding: 0.15rem 0.2rem 0.3rem 0.45rem;
  border-top: 0;
  border-left: 3px solid var(--link);
  border-radius: 0 0.4rem 0.4rem 0;
  background: color-mix(in srgb, var(--link) 14%, var(--card));
}

.topic-block[open] + .topic-block {
  border-top: 0;
}

.topic-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0.5rem 0.35rem;
  border: 0;
  border-radius: 0.35rem;
  background: transparent;
  color: var(--text);
  font: 600 1rem/1.3 var(--sans);
  text-align: left;
  cursor: pointer;
  list-style: none;
}

.topic-toggle::-webkit-details-marker {
  display: none;
}

.topic-toggle::marker {
  content: "";
}

.topic-toggle:hover {
  background: var(--hover);
  color: var(--text);
}

.topic-block[open] > .topic-toggle {
  background: transparent;
}

.topic-toggle::before {
  content: "";
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.6rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}

.topic-block[open] > .topic-toggle::before {
  transform: rotate(45deg) translate(-1px, -1px);
}

.outline-pages {
  list-style: none;
  margin: 0.25rem 0 0.5rem;
  padding: 0;
}

.outline-pages a,
.outline-pending {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.35rem 0.65rem;
  border-radius: 0.4rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
}

.outline-pages a:hover {
  background: var(--hover);
  color: var(--text);
}

.outline-pages a[aria-current="page"] {
  background: var(--pill);
  color: var(--pill-text);
}

.outline-pages a[aria-current="page"]:hover {
  background: var(--pill);
  color: var(--pill-text);
}

.outline-badge {
  flex: 0 0 auto;
  padding: 0.14rem 0.45rem;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: var(--bg-deep);
  color: var(--text);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.outline-pages a[aria-current="page"] .outline-badge {
  border-color: transparent;
}

.course-main {
  min-width: 0;
}

.lesson-card {
  min-width: 0;
  padding: 0.75rem 0.75rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--card);
}

.lesson-card > .canvas-root {
  max-width: 100%;
}

.lesson-card > .canvas-root h1 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2rem);
  line-height: 1.25;
  letter-spacing: normal;
}

.canvas-root mjx-container[display="true"] {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.35rem;
}

.canvas-root svg {
  max-width: 100%;
}

.canvas-root summary {
  min-height: 44px;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.canvas-root audio {
  min-height: 44px;
  width: 100%;
  max-width: 28rem;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.55rem 0.95rem;
  border-radius: 0.45rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  font-weight: 600;
  text-decoration: none;
}

.pager-btn:hover {
  background: var(--btn-hover);
  color: var(--btn-text);
}

.alkimi-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0.35rem 0 0.85rem;
}

.alkimi-launch,
.alkimi-newtab,
.alkimi-collapse {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.85rem;
  border-radius: 0.45rem;
  font: 600 1rem/1.2 var(--sans);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.alkimi-launch,
.alkimi-collapse {
  border: 2px solid var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-text);
}

.alkimi-launch:hover,
.alkimi-collapse:hover {
  border-color: var(--btn-hover);
  background: var(--btn-hover);
  color: var(--btn-text);
}

.alkimi-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.45rem;
}

.alkimi-newtab {
  border: 0;
  background: transparent;
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.alkimi-newtab:hover {
  background: transparent;
  color: var(--link-hover);
}

.alkimi-launch:disabled,
.alkimi-newtab:disabled {
  border-color: var(--line);
  background: var(--bg-deep);
  color: var(--text);
  cursor: not-allowed;
}

.alkimi-note {
  margin: 0;
  padding: 0.9rem 1rem;
  border: 1px dashed var(--line);
  border-radius: 0.6rem;
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}

.alkimi-card,
.alkimi-card-practice {
  border-radius: 0.75rem;
  padding: 1.75rem;
  margin-bottom: 2.5rem;
}

.alkimi-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.alkimi-card-practice {
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
}

.alkimi-card h2,
.alkimi-card-practice h2 {
  margin-top: 0;
  font-size: 1.25rem;
}

.alkimi-card h2,
.alkimi-card p {
  color: #14532d;
}

.alkimi-card-practice h2,
.alkimi-card-practice p {
  color: #3b0764;
}

@media (prefers-color-scheme: dark) {
  .alkimi-card {
    background: #052e16;
    border-color: #166534;
  }

  .alkimi-card h2,
  .alkimi-card p {
    color: #bbf7d0;
  }

  .alkimi-card-practice {
    background: #2e1064;
    border-color: #6d28d9;
  }

  .alkimi-card-practice h2,
  .alkimi-card-practice p {
    color: #ddd6fe;
  }
}

.alkimi-frame iframe {
  width: 100%;
  height: 600px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
  background: var(--card);
}

@media (max-width: 679px) {
  .alkimi-sandbox {
    margin-inline: 0.75rem;
  }

  .alkimi-frame iframe {
    height: 600px;
    min-height: 0;
    max-height: none;
  }
}

@media (pointer: coarse) {
  .outline-toggle {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .unit-select-wrap select,
  .unit-select-display,
  .topic-toggle,
  .canvas-root summary,
  .canvas-root audio,
  .instructor-footer .embed-open,
  .dialog-actions button,
  .dialog-actions .dialog-close {
    min-height: 44px;
    min-width: 44px;
  }
}

body.drawer-open {
  overflow: hidden;
}

.site-footer:has(.instructor-footer) {
  padding-top: 0;
}

.instructor-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: calc(var(--instructor-bar-height) + env(safe-area-inset-bottom, 0px));
  min-height: var(--instructor-bar-height);
  margin: 0;
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  border-top: 1px solid var(--rule);
  border-bottom: 0;
  background-color: var(--card);
  color: var(--text);
}

@supports (backdrop-filter: blur(10px)) {
  .instructor-footer {
    background-color: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

.instructor-inner {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1.25rem;
  width: 100%;
  margin: 0;
  padding-inline: clamp(1rem, 2vw, 2rem);
}

.instructor-copy {
  margin: 0;
  min-width: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.3;
}

.instructor-copy a {
  color: var(--link);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

.instructor-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.instructor-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.instructor-footer .embed-open {
  min-height: 36px;
  min-width: 44px;
  margin: 0;
  padding: 0.2rem 0.75rem;
  font-size: 0.92rem;
  line-height: 1.2;
}

@media (pointer: coarse) {
  .instructor-footer .embed-open,
  .dialog-actions button,
  .dialog-actions .dialog-close {
    min-height: 44px;
    min-width: 44px;
  }
}

html:not([data-embed]) .sidebar-clip-inner {
  padding-bottom: 1.25rem;
}

@media (max-width: 680px) {
  :root {
    --instructor-bar-height: 6.75rem;
  }

  .instructor-footer {
    height: auto;
    min-height: calc(var(--instructor-bar-height) + env(safe-area-inset-bottom, 0px));
    padding-top: 0.4rem;
    padding-bottom: calc(0.4rem + env(safe-area-inset-bottom, 0px));
  }

  .instructor-inner {
    flex-wrap: wrap;
    row-gap: 0.35rem;
  }

  .instructor-copy {
    flex: 1 1 100%;
    font-size: 0.78rem;
  }

  .instructor-actions {
    flex: 1 1 auto;
    justify-content: flex-end;
  }

  .instructor-label {
    font-size: 0.85rem;
  }

  .instructor-footer .embed-open {
    font-size: 0.85rem;
    padding-inline: 0.55rem;
  }
}

@media (max-height: 550px) {
  html:not([data-embed]) body {
    padding-bottom: 0;
  }

  .instructor-footer {
    position: static;
    height: auto;
  }

  html:not([data-embed]) .sidebar-clip {
    height: 100dvh;
    max-height: 100dvh;
  }

  html:not([data-embed]) .sidebar-clip-inner {
    padding-bottom: 1.25rem;
  }
}

#embed-dialog {
  width: 100vw;
  max-width: 100vw;
  height: 100vh;
  max-height: 100vh;
  margin: 0;
  padding: 1.25rem;
  overflow: hidden;
  border: 0;
  background: transparent;
  color: var(--text);
}

#embed-dialog[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}

#embed-dialog:not([open]) {
  display: none;
}

.embed-dialog-panel {
  width: min(40rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2.5rem);
  overflow: auto;
  padding: 1.25rem 1.25rem 1rem;
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 18px 50px rgba(11, 19, 32, 0.28);
}

#embed-dialog::backdrop {
  background: rgba(11, 19, 32, 0.62);
}

#embed-dialog h2 {
  font-size: 1.55rem;
}

#embed-dialog p {
  color: var(--text);
}

#embed-dialog fieldset {
  margin: 0 0 0.85rem;
  padding: 0.35rem 0.9rem 0.5rem;
  border: 1px solid var(--line);
}

#embed-dialog legend {
  padding: 0 0.35rem;
  color: var(--text);
  font-weight: 600;
}

#embed-dialog label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-height: 44px;
  cursor: pointer;
}

#embed-dialog input[type="radio"],
#embed-dialog input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--link);
}

#embed-code {
  width: 100%;
  min-height: 8.5rem;
  margin-top: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.92rem;
  line-height: 1.45;
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.85rem;
}

.dialog-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.9rem;
  border: 2px solid var(--btn-bg);
  border-radius: 0.45rem;
  background: var(--btn-bg);
  color: var(--btn-text);
  font: 600 1rem/1.2 var(--sans);
  cursor: pointer;
}

.dialog-actions button:hover {
  border-color: var(--btn-hover);
  background: var(--btn-hover);
  color: var(--btn-text);
}

.dialog-actions .dialog-close {
  border-color: var(--rule);
  background: var(--card);
  color: var(--text);
}

.dialog-actions .dialog-close:hover {
  background: var(--hover);
  color: var(--text);
}

#embed-status {
  min-height: 1.4rem;
  margin: 0.65rem 0 0;
  font-weight: 600;
}

html[data-embed] .instructor-footer,
html[data-embed="lesson"] .site-header,
html[data-embed="lesson"] .course-bar,
html[data-embed="lesson"] .course-sidebar,
html[data-embed="lesson"] .drawer-backdrop,
html[data-embed="lesson"] .pager,
html[data-embed="lesson"] .site-footer,
html[data-embed="course"] .site-header,
html[data-embed="course"] .site-footer {
  display: none !important;
}

html[data-embed="full"] .site-footer {
  padding-top: 1.2rem;
}

html[data-embed="lesson"] .course-frame,
html[data-embed="lesson"] .course-app {
  display: block;
  width: min(52rem, calc(100% - 1.5rem));
  margin-inline: auto;
}

html[data-embed]:not([data-newtab="1"]) .open-newtab,
html[data-embed]:not([data-newtab="1"]) .alkimi-newtab {
  display: none !important;
}

@media (min-width: 901px) {
  .course-bar,
  .drawer-close,
  .drawer-backdrop {
    display: none !important;
  }

  .outline-toggle {
    display: inline-flex;
  }

  .course-frame {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 0;
    width: 100%;
    margin: 0;
  }

  .course-sidebar {
    align-self: stretch;
    position: relative;
    z-index: 15;
    top: auto;
    bottom: auto;
    left: auto;
    flex: 0 0 265px;
    width: 265px;
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: visible;
    transform: none;
    border-right: 1px solid var(--rule);
    border-radius: 0;
    background: var(--card);
    transition: flex-basis 0.24s ease, width 0.24s ease;
  }

  .sidebar-clip {
    position: sticky;
    top: 0;
    height: calc(100dvh - var(--instructor-bar-height, 48px));
    max-height: 100%;
    overflow: hidden;
    background: var(--card);
    border-right: 0;
  }

  .unit-field {
    margin-right: -0.85rem;
    margin-left: -0.85rem;
    padding-right: 0.85rem;
    padding-left: 0.85rem;
  }

  .sidebar-clip-inner {
    width: 265px;
    height: 100%;
    overflow: auto;
    padding: 1rem 0.85rem 1.25rem;
    background: var(--card);
    transform: translateX(0);
    transition: transform 0.24s ease;
  }

  html[data-outline="closed"] .course-sidebar {
    flex-basis: 0;
    width: 0;
    border-right: 0;
    background: transparent;
  }

  html[data-outline="closed"] .sidebar-clip-inner {
    transform: translateX(-265px);
    pointer-events: none;
  }

  html[data-embed] .sidebar-clip {
    height: 100dvh;
    max-height: 100dvh;
  }

  html[data-embed="course"] .sidebar-clip {
    top: 38px;
    height: calc(100dvh - 38px);
    max-height: calc(100dvh - 38px);
  }

  .course-main {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
    padding: 0.85rem 1.15rem 1.25rem 2.15rem;
  }

  .course-main > .site-footer {
    margin-top: auto;
  }

  .lesson-card {
    padding: 1rem 1.25rem 1.35rem;
  }

  html[data-embed="lesson"] .course-frame {
    display: block;
    width: min(52rem, calc(100% - 1.5rem));
    margin-inline: auto;
  }

  html[data-embed="lesson"] .course-main {
    padding: 0;
  }
}

@media (min-width: 901px) and (min-height: 551px) {
  html:not([data-embed]) .course-sidebar {
    position: sticky;
    top: var(--site-header-height);
    align-self: flex-start;
    height: calc(100dvh - var(--site-header-height) - var(--instructor-bar-height));
    max-height: calc(100dvh - var(--site-header-height) - var(--instructor-bar-height));
  }

  html[data-embed="full"] .course-sidebar {
    position: sticky;
    top: var(--site-header-height);
    align-self: flex-start;
    height: calc(100dvh - var(--site-header-height));
    max-height: calc(100dvh - var(--site-header-height));
  }

  html[data-embed="course"] .course-sidebar {
    position: sticky;
    top: 38px;
    align-self: flex-start;
    height: calc(100dvh - 38px);
    max-height: calc(100dvh - 38px);
  }

  html:not([data-embed="lesson"]) .sidebar-clip {
    position: relative;
    top: auto;
    height: 100%;
    max-height: 100%;
  }
}

@media (max-width: 900px) {
  html:not([data-embed="lesson"]) #lesson {
    scroll-margin-top: calc(var(--site-header-height) + 1rem);
  }
}

@media (min-width: 901px) and (max-height: 550px) {
  html:not([data-embed]) .course-sidebar {
    position: relative;
    top: auto;
    height: auto;
    max-height: none;
    align-self: stretch;
  }

  html:not([data-embed]) .sidebar-clip {
    position: sticky;
    top: 0;
    height: 100dvh;
    max-height: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .course-sidebar,
  .sidebar-clip-inner,
  .outline-toggle svg {
    transition: none;
  }
}

.downloads-nav,
.downloads-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--rule);
  border-radius: 0.45rem;
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  text-decoration: none;
}

.downloads-nav {
  margin: 0 0 0.85rem;
}

.downloads-nav-short {
  display: none;
}

.downloads-nav:hover,
.downloads-bar:hover {
  background: var(--hover);
  color: var(--text);
}

.downloads-nav[aria-current="page"],
.downloads-bar[aria-current="page"] {
  background: var(--pill);
  color: var(--pill-text);
}

.downloads-nav[aria-current="page"]:hover,
.downloads-bar[aria-current="page"]:hover {
  background: var(--pill);
  color: var(--pill-text);
}

.downloads h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.85rem, 4vw, 2.7rem);
  line-height: 1.15;
}

.dl-bundles,
.dl-browse {
  margin-top: 1.5rem;
}

.dl-bundles h2,
.dl-unit h2 {
  margin-bottom: 0.75rem;
}

.dl-summary {
  max-width: 40rem;
  margin: 0 0 0.85rem;
  color: var(--muted);
}

.dl-actionbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  background: var(--bg);
}

.dl-zip,
.dl-tool,
.dl-actions a,
.dl-scope label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 0.5rem 0.8rem;
  border-radius: 0.45rem;
  font: 600 1rem/1.2 var(--sans);
  text-align: center;
}

.dl-zip,
.dl-tool {
  border: 2px solid var(--rule);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}

.dl-primary {
  flex: 1 1 16rem;
  border-color: var(--btn-bg);
  background: var(--btn-bg);
  color: var(--btn-text);
}

.dl-zip:hover,
.dl-tool:hover {
  border-color: var(--btn-hover);
  background: var(--hover);
  color: var(--text);
}

.dl-primary:hover {
  border-color: var(--btn-hover);
  background: var(--btn-hover);
  color: var(--btn-text);
}

.dl-zip:disabled,
.dl-tool:disabled {
  border-color: var(--line);
  background: var(--bg-deep);
  color: var(--text);
  cursor: not-allowed;
}

.dl-status {
  flex: 1 1 100%;
  min-height: 1.5rem;
  margin: 0;
  font-weight: 600;
}

.dl-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 0.85rem;
}

.dl-scope {
  margin: 0 0 1.25rem;
  padding: 0.35rem 0.9rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.dl-scope legend {
  padding: 0 0.35rem;
  color: var(--text);
  font-weight: 600;
}

.dl-scope label {
  display: flex;
  justify-content: flex-start;
  gap: 0.7rem;
  width: fit-content;
  max-width: 100%;
  cursor: pointer;
}

.dl-topic-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.dl-scope input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--link);
}

.dl-unit + .dl-unit {
  margin-top: 1.75rem;
}

.dl-topic {
  padding: 0.35rem 0 0.85rem;
  border-top: 1px solid var(--line);
}

.dl-topic-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  padding: 0.35rem 0;
}

.dl-topic-head h3 {
  flex: 1 1 100%;
  margin: 0;
}

.dl-topic-toggle {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 0.45rem 0.2rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: left;
  cursor: pointer;
}

.dl-topic-toggle::before {
  content: "";
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  margin-right: 0.65rem;
  border-right: 2px solid var(--text);
  border-bottom: 2px solid var(--text);
  transform: rotate(-45deg);
}

.dl-topic-toggle[aria-expanded="true"]::before {
  transform: rotate(45deg) translateY(-2px);
}

.dl-packet {
  flex: 0 1 auto;
}

.dl-rows {
  list-style: none;
  margin: 0;
  padding: 0 0 0.25rem;
}

.dl-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem 1rem;
  padding: 0.7rem 0;
  border-top: 1px solid var(--line);
}

.dl-lesson {
  flex: 1 1 12rem;
  margin: 0;
  font-weight: 600;
}

.dl-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.dl-actions a {
  border: 2px solid var(--rule);
  background: var(--card);
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.dl-actions a:hover {
  border-color: var(--btn-hover);
  background: var(--hover);
  color: var(--text);
}

.dl-pending {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.35rem 0.15rem;
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 720px) {
  .dl-packet,
  .dl-actions,
  .dl-actions li,
  .dl-actions a {
    flex: 1 1 100%;
  }

  .dl-actions a,
  .dl-packet {
    width: 100%;
  }
}

@media (min-width: 901px) {
  .downloads-bar {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .dl-topic-toggle::before {
    transition: none;
  }
}

@media print {
  html body {
    padding-bottom: 0 !important;
  }

  .open-newtab,
  .embed-brand,
  .embed-credit,
  .outline-toggle,
  .site-header,
  .course-bar,
  .course-sidebar,
  .drawer-backdrop,
  .pager,
  .instructor-footer,
  .alkimi-actions,
  .alkimi-frame,
  .dl-actionbar,
  .dl-toolbar,
  .dl-scope,
  .dl-packet {
    display: none !important;
  }

  .course-frame,
  .course-app {
    display: block !important;
    width: auto !important;
    margin: 0 !important;
  }
}
