.portfolio-course-nav {
  position: fixed !important;
  top: auto !important;
  right: auto !important;
  bottom: 1rem !important;
  left: 1rem !important;
  z-index: 9999;
  display: block !important;
  width: min(15rem, calc(100vw - 2rem)) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  color: #f8fafc;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transform: none !important;
}

.portfolio-course-nav details {
  border: 1px solid #475569;
  border-radius: 0.85rem;
  background: rgba(15, 23, 42, 0.97);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.3);
}

.portfolio-course-nav summary {
  padding: 0.75rem 1rem;
  color: #ffffff;
  font-size: 0.88rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
  list-style-position: inside;
}

.portfolio-course-nav-links {
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 0.5rem !important;
  height: auto !important;
  padding: 0 0.65rem 0.65rem;
}

.portfolio-course-nav a {
  display: inline-flex;
  min-height: 2.35rem;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border: 1px solid #64748b;
  border-radius: 999px;
  color: #f8fafc;
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: normal;
}

.portfolio-course-nav .course-theme-toggle {
  display: inline-flex;
  min-height: 2.35rem;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border: 1px solid #f6c453;
  border-radius: 999px;
  background: #f6c453;
  color: #111827;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
  cursor: pointer;
}

.portfolio-course-nav .course-theme-toggle:hover,
.portfolio-course-nav .course-theme-toggle:focus-visible {
  background: #fde68a;
}

html[data-coursework-theme="dark"] {
  color-scheme: dark;
}

html[data-coursework-theme="dark"] body {
  background: #0f172a !important;
  color: #f8fafc !important;
}

html[data-coursework-theme="dark"] body > header,
html[data-coursework-theme="dark"] body > main,
html[data-coursework-theme="dark"] body > footer,
html[data-coursework-theme="dark"] main > section,
html[data-coursework-theme="dark"] .page {
  background-color: #111827 !important;
  color: #f8fafc !important;
}

html[data-coursework-theme="dark"] article,
html[data-coursework-theme="dark"] table,
html[data-coursework-theme="dark"] pre,
html[data-coursework-theme="dark"] code,
html[data-coursework-theme="dark"] [class*="card"] {
  border-color: #475569 !important;
  background-color: #1e293b !important;
  color: #f8fafc !important;
}

html[data-coursework-theme="dark"] h1,
html[data-coursework-theme="dark"] h2,
html[data-coursework-theme="dark"] h3,
html[data-coursework-theme="dark"] h4,
html[data-coursework-theme="dark"] p,
html[data-coursework-theme="dark"] li,
html[data-coursework-theme="dark"] dt,
html[data-coursework-theme="dark"] dd,
html[data-coursework-theme="dark"] th,
html[data-coursework-theme="dark"] td {
  color: #f8fafc !important;
}

html[data-coursework-theme="dark"] a:not(.portfolio-course-nav a) {
  color: #93c5fd !important;
}

.portfolio-course-nav a:hover,
.portfolio-course-nav a:focus-visible {
  border-color: #5eead4;
  background: #5eead4;
  color: #0f172a;
}

.portfolio-course-nav .portfolio-return-link {
  border-color: #7c9cff;
  background: #3157d5;
  color: #ffffff;
}

/* Email addresses must remain legible across every legacy light and dark theme. */
a[href^="mailto:"]:not(.button) {
  display: inline-block;
  max-width: 100%;
  padding: 0.12em 0.35em;
  border: 1px solid #93c5fd;
  border-radius: 0.3rem;
  background: #eff6ff !important;
  color: #0b4778 !important;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.16em;
}

a[href^="mailto:"]:not(.button):hover,
a[href^="mailto:"]:not(.button):focus-visible {
  border-color: #38bdf8;
  background: #dbeafe !important;
  color: #082f49 !important;
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
}

@media (max-width: 42rem) {
  .portfolio-course-nav {
    bottom: 0.5rem !important;
    left: 0.5rem !important;
    width: min(13rem, calc(100vw - 1rem)) !important;
  }
}

/* Keep shared coursework controls compact when a lesson page is shown in an iframe. */
.embedded-page .portfolio-course-nav {
  bottom: 0.4rem !important;
  left: 0.4rem !important;
  width: min(9.5rem, calc(100vw - 5.5rem)) !important;
}

.embedded-page .portfolio-course-nav summary {
  overflow: hidden;
  padding: 0.5rem 0.65rem;
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.embedded-page .portfolio-course-nav-links {
  gap: 0.35rem !important;
  padding: 0 0.4rem 0.4rem;
}

.embedded-page .portfolio-course-nav a,
.embedded-page .portfolio-course-nav .course-theme-toggle {
  min-height: 1.9rem;
  padding: 0.35rem 0.45rem;
  font-size: 0.68rem;
}
