/* ===================================================================
   Athalta — Course index sidebar (right-side drawer)
   Internal layout is Flexbox / Grid. The drawer itself is position:
   fixed so it can sit on the right without covering the page in a modal.
   =================================================================== */

.athalta-sidebar-open {
  position: fixed;
  top: 6.75rem;
  right: 0;
  z-index: 12001;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.55rem 0.65rem;
  border: 0;
  border-radius: 0.7rem 0 0 0.7rem;
  background: var(--rose, #c37f80);
  color: var(--white, #ffffff);
  cursor: pointer;
  box-shadow: 0 0.25rem 0.75rem rgba(31, 61, 100, 0.16);
  transition: all 0.3s ease;
}

.athalta-sidebar-root.is-open .athalta-sidebar-open {
  opacity: 0;
  pointer-events: none;
}

.athalta-sidebar-open:hover {
  transform: translateX(-2px);
  box-shadow: 0 0.35rem 0.75rem rgba(31, 61, 100, 0.16);
}

.athalta-sidebar-open svg,
.athalta-sidebar-close svg {
  display: block;
  width: 1.35rem;
  height: auto;
  flex-shrink: 0;
}

.athalta-sidebar {
  --sb-teal: #49bbbd;
  --sb-rose: #c37f80;
  --sb-navy: #1f3d64;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 12000;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(24.5rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 1.15rem 0.85rem 1.15rem 0.55rem;
  overflow: hidden;
  border: 0.3125rem solid var(--sb-teal);
  border-radius: 0.9375rem;
  background: #ffffff;
  color: var(--sb-navy);
  box-shadow: 0 0.75rem 2rem rgba(31, 61, 100, 0.18);
  direction: rtl;
  text-align: right;
  transform: translateX(calc(100% + 1.25rem));
  visibility: hidden;
  pointer-events: none;
  transition: transform 0.3s ease, visibility 0.3s ease;
}

.athalta-sidebar.is-open {
  transform: translateX(0);
  visibility: visible;
  pointer-events: auto;
}

.athalta-sidebar-header {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  width: 100%;
  flex-shrink: 0;
  padding-inline: 0.35rem;
}

.athalta-sidebar-title {
  margin: 0;
  min-width: 0;
  color: var(--sb-teal);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.athalta-sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.5rem 0.6rem;
  border: 0;
  border-radius: 0.7rem;
  background: var(--sb-rose);
  color: #ffffff;
  cursor: pointer;
  transition: all 0.3s ease;
}

.athalta-sidebar-close:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.3rem 0.65rem rgba(31, 61, 100, 0.16);
}

.athalta-sidebar-progress {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
  flex-shrink: 0;
  padding-inline: 0.35rem;
}

.athalta-sidebar-progress-meta {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.athalta-sidebar-progress-icon {
  display: block;
  width: 1.25rem;
  height: auto;
  flex-shrink: 0;
  color: var(--sb-teal);
}

.athalta-sidebar-progress-text {
  color: var(--sb-teal);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

.athalta-sidebar-segments {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.28rem;
  width: 100%;
}

.athalta-sidebar-segment {
  min-height: 0.42rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--sb-teal);
  opacity: 0.25;
  transition: opacity 0.3s ease, background-color 0.3s ease;
}

.athalta-sidebar-segment.is-filled {
  opacity: 1;
}

.athalta-sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 0.15rem 0.45rem 0.15rem 0.35rem;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: #c5c5c5 transparent;
}

.athalta-sidebar-scroll::-webkit-scrollbar {
  width: 0.5rem;
}

.athalta-sidebar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.athalta-sidebar-scroll::-webkit-scrollbar-thumb {
  background: #c5c5c5;
  border-radius: 999px;
}

.athalta-sidebar-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.athalta-sidebar-map {
  width: 100%;
}

.athalta-sidebar-map-link {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 0.85rem 0.9rem;
  border-radius: 0.7rem;
  background: rgba(73, 187, 189, 0.12);
  color: var(--sb-navy);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
  text-decoration: none;
  text-align: right;
  cursor: pointer;
  transition: all 0.3s ease;
}

.athalta-sidebar-map-link:hover {
  background: rgba(73, 187, 189, 0.2);
}

.athalta-sidebar-map-link.is-active {
  background: rgba(73, 187, 189, 0.28);
}

.athalta-sidebar-unit {
  width: 100%;
  border: 0.125rem solid var(--sb-rose);
  border-radius: 1.1875rem;
  background: #ffffff;
  overflow: hidden;
  transition: all 0.3s ease;
}

.athalta-sidebar-unit-toggle {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 0;
  background: transparent;
  color: var(--sb-navy);
  text-align: right;
  cursor: pointer;
  transition: all 0.3s ease;
}

.athalta-sidebar-unit-toggle:hover {
  background: rgba(195, 127, 128, 0.06);
}

.athalta-sidebar-unit-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.2rem;
  min-width: 0;
  flex: 1 1 auto;
}

.athalta-sidebar-unit-title-row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  min-width: 0;
}

.athalta-sidebar-unit-title {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--sb-navy);
  font-size: 0.9375rem;
  font-weight: 700;
  line-height: 1.35;
}

.athalta-sidebar-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  color: var(--sb-teal);
}

.athalta-sidebar-check[hidden] {
  display: none;
}

.athalta-sidebar-check svg {
  width: 1.05rem;
  height: auto;
  flex-shrink: 0;
}

.athalta-sidebar-unit-meta {
  display: inline-flex;
  flex-wrap: nowrap;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  color: var(--sb-teal);
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.4;
}

.athalta-sidebar-book {
  display: block;
  width: 1rem;
  height: auto;
  flex-shrink: 0;
}

.athalta-sidebar-chevron {
  display: block;
  width: 0.85rem;
  height: auto;
  flex-shrink: 0;
  color: var(--sb-rose);
  transition: transform 0.3s ease;
}

.athalta-sidebar-unit.is-open .athalta-sidebar-chevron {
  transform: rotate(180deg);
}

.athalta-sidebar-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.3s ease;
}

.athalta-sidebar-unit.is-open .athalta-sidebar-panel {
  grid-template-rows: 1fr;
}

.athalta-sidebar-panel-inner {
  min-height: 0;
  overflow: hidden;
}

.athalta-sidebar-pages {
  display: flex;
  flex-direction: column;
  width: 100%;
  margin: 0;
  padding: 0 0.85rem 0.35rem;
  list-style: none;
}

.athalta-sidebar-page {
  width: 100%;
  border-top: 0.0625rem solid rgba(195, 127, 128, 0.55);
}

.athalta-sidebar-link {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
  padding: 0.7rem 0.15rem;
  color: var(--sb-navy);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.55;
  text-decoration: none;
  text-align: right;
  cursor: pointer;
  transition: all 0.3s ease;
}

.athalta-sidebar-link:hover {
  color: var(--sb-teal);
}

.athalta-sidebar-link.is-active {
  font-weight: 700;
  background: rgba(73, 187, 189, 0.1);
  border-radius: 0.5rem;
  padding-inline: 0.45rem;
}

.athalta-sidebar-page-index {
  flex-shrink: 0;
}

.athalta-sidebar-page-label {
  flex: 1 1 auto;
  min-width: 0;
}

.visited-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: center;
  flex-shrink: 0;
  margin-inline-start: auto;
  padding: 0;
  color: var(--sb-teal, #49bbbd);
}

.visited-check svg {
  display: block;
  width: 1rem;
  height: auto;
  flex-shrink: 0;
}

.athalta-sidebar-demo-note {
  max-width: var(--prose-measure, 47em);
  margin: 0;
  color: var(--navy, #1f3d64);
  font-size: 1rem;
  line-height: 1.7;
  text-align: right;
  text-wrap: pretty;
}

@media (max-width: 56.25rem) {
  .athalta-sidebar {
    top: 0;
    right: 0;
    width: min(24.5rem, 100vw);
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }

  .athalta-sidebar-title {
    font-size: clamp(1.25rem, 1rem + 1.2vw, 1.375rem);
  }

  .athalta-sidebar-scroll {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (max-width: 768px) {
  .athalta-sidebar-unit-title,
  .athalta-sidebar-link,
  .athalta-sidebar-link span {
    white-space: normal;
    overflow-wrap: break-word;
    line-height: 1.45;
  }

  .athalta-sidebar-unit-title,
  .athalta-sidebar-page-label {
    min-width: 0;
    flex: 1 1 auto;
  }
}

@media (max-width: 82rem) and (min-width: 51.3125rem) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: var(--white, #ffffff);
  }

  .athalta-sidebar-open {
    top: 2rem;
    right: auto;
    left: 1rem;
    border-radius: 0.7rem;
  }

  .athalta-sidebar-open:hover {
    transform: translateY(-2px);
  }
}

@media (max-width: 51.25rem) {
  .athalta-sidebar-open {
    display: none;
  }

  .main-nav .athalta-sidebar.is-mobile-embedded,
  .main-nav .athalta-sidebar.is-mobile-embedded.is-open {
    position: static;
    top: auto;
    right: auto;
    z-index: auto;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: none;
    margin: 0.75rem 0 0;
    padding: 0.25rem 0 0;
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    transform: none;
    visibility: visible;
    pointer-events: auto;
  }

  .main-nav .athalta-sidebar.is-mobile-embedded .athalta-sidebar-header {
    display: none;
  }

  .main-nav .athalta-sidebar.is-mobile-embedded .athalta-sidebar-scroll {
    max-height: none;
    overflow: visible;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  }
}

@media (prefers-reduced-motion: reduce) {
  .athalta-sidebar,
  .athalta-sidebar-panel,
  .athalta-sidebar-chevron,
  .athalta-sidebar-open,
  .athalta-sidebar-close,
  .athalta-sidebar-link,
  .athalta-sidebar-unit-toggle,
  .athalta-sidebar-segment {
    transition: none;
  }
}

/* Keyboard focus: one turquoise ring on every interactive control. */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 2px solid #49BBBD;
  outline-offset: 2px;
}
