/* Header + tabs */
.md-header,
.md-tabs {
  background: var(--bar-gradient) !important;
  background-size: 180% 180%;
  animation: headerGradient 18s ease infinite;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.24) !important;
}

[data-md-color-scheme="slate"] .md-header,
[data-md-color-scheme="slate"] .md-tabs {
  background: var(--bar-gradient) !important;
  animation: none !important;
  box-shadow: none !important;
}

[data-md-color-scheme="slate"] .md-header {
  border-bottom: 0 !important;
}

[data-md-color-scheme="slate"] .md-tabs {
  border-top: 0 !important;
}

@keyframes headerGradient {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.md-header__inner,
.md-tabs__inner {
  background: transparent !important;
  margin: 0 !important;
  width: 100% !important;
  max-width: none !important;
  padding-left: 0.75rem !important;
  padding-right: 0.75rem !important;
}

.md-header__inner.md-grid,
.md-tabs__inner.md-grid,
.md-header .md-grid,
.md-tabs .md-grid {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
}

.md-header__button.md-logo img,
.md-header__button.md-logo svg {
  height: 2.3rem !important;
  width: auto !important;
  filter: drop-shadow(0 1px 3px rgba(15, 23, 42, 0.42));
}

.md-tabs__link {
  border-radius: 999px;
  padding: 0.34rem 0.84rem;
  font-weight: 700;
}

.md-tabs__link:hover,
.md-tabs__link--active {
  background: rgba(255, 255, 255, 0.2);
}

/* Search and top action area */
.md-search__form {
  border-radius: 0.8rem;
  background: rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.16);
}

[data-md-color-scheme="slate"] .md-search__form {
  background: rgba(20, 30, 55, 0.88) !important;
  border-color: rgba(167, 139, 250, 0.28) !important;
  box-shadow: none !important;
}

[data-md-color-scheme="slate"] .md-search__form * {
  box-shadow: none !important;
}

[data-md-color-scheme="slate"] .md-search__form,
[data-md-color-scheme="slate"] .md-search__input,
[data-md-color-scheme="slate"] .md-search__input::placeholder,
[data-md-color-scheme="slate"] .md-search__icon {
  background: transparent !important;
}

.md-search__input,
.md-search__input::placeholder,
.md-search__icon {
  color: #f8fafc !important;
}

/* Header actions injected by JS */
.header-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-left: 0.55rem;
}

.header-icon-btn,
.header-cta {
  height: 2.1rem;
  width: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.24);
  transition: transform 160ms ease, background 160ms ease;
}

.header-icon-btn svg {
  width: 1rem;
  height: 1rem;
  fill: #fff;
}

.header-toggle-btn.is-active {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.55);
}

.header-cta {
  width: auto;
  padding: 0 0.88rem;
  color: #fff !important;
  text-decoration: none !important;
  font-weight: 800;
  font-size: 0.78rem;
}

.header-icon-btn:hover,
.header-cta:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.24);
}

[dir="rtl"] .header-actions {
  margin-left: 0;
  margin-right: 0.55rem;
}

/* Sidebar collapse toggles (desktop) */
@media (min-width: 1220px) {
  body.sg-hide-left-sidebar .md-sidebar--primary {
    display: none !important;
  }

  body.sg-hide-right-sidebar .md-sidebar--secondary {
    display: none !important;
  }

  body.sg-hide-left-sidebar .md-main__inner {
    grid-template-columns: 0 minmax(0, 1fr) minmax(13rem, 16rem) !important;
  }

  body.sg-hide-right-sidebar .md-main__inner {
    grid-template-columns: minmax(13rem, 16rem) minmax(0, 1fr) 0 !important;
  }

  body.sg-hide-left-sidebar.sg-hide-right-sidebar .md-main__inner {
    grid-template-columns: 0 minmax(0, 1fr) 0 !important;
  }
}

/* Typography */
.md-typeset h1 {
  font-weight: 900 !important;
  letter-spacing: -0.02em;
}

.md-typeset h2 {
  margin-top: 2.2rem !important;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line-soft);
}

.md-typeset h3 {
  font-weight: 800 !important;
  color: #6d28d9;
}

[data-md-color-scheme="slate"] .md-typeset h3 {
  color: #c4b5fd;
}

/* Remove visible pilcrow/hash heading anchors for cleaner look */
.md-typeset .headerlink {
  display: none !important;
}

.md-typeset p,
.md-typeset li,
.md-typeset td {
  color: var(--text-main);
}

.md-typeset a {
  color: #7c3aed;
}

[data-md-color-scheme="slate"] .md-typeset a {
  color: #c4b5fd;
}

/* Primary sidebar */
.md-sidebar--primary {
  padding-top: 0.35rem;
}

.md-nav--primary .md-nav__title {
  background: linear-gradient(120deg, var(--brand-2), var(--brand-3), var(--brand-4)) !important;
  color: #fff !important;
  border-radius: 0.82rem !important;
  padding: 0.5rem 0.8rem !important;
  margin: 0.4rem 0.45rem 0.65rem !important;
  font-weight: 800 !important;
}

.md-nav--primary .md-nav__item > .md-nav__link {
  border-radius: 0.62rem;
  margin: 0.09rem 0.22rem;
  padding: 0.34rem 0.62rem;
}

.md-nav--primary .md-nav__item > .md-nav__link:hover {
  background: rgba(167, 139, 250, 0.2);
}

.md-nav--primary .md-nav__link--active {
  color: #5b21b6 !important;
  background: rgba(167, 139, 250, 0.26) !important;
  font-weight: 800 !important;
}

/* Highlight only top section headers in the primary nav (not every item) */
.md-nav--primary > .md-nav__list > .md-nav__item--active > .md-nav > .md-nav__list > .md-nav__item--nested > .md-nav__link {
  border-radius: 0.72rem;
  margin: 0.2rem 0.22rem;
  padding: 0.4rem 0.68rem;
  color: #fff !important;
  font-weight: 800 !important;
  background: linear-gradient(120deg, var(--brand-2), var(--brand-3), var(--brand-4)) !important;
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.2);
}

.md-nav--primary > .md-nav__list > .md-nav__item--active > .md-nav > .md-nav__list > .md-nav__item--nested > .md-nav__link:hover {
  filter: brightness(1.03);
}

/* Primary section root row (e.g., "Career Development") */
.md-nav--primary > .md-nav__list > .md-nav__item--section > .md-nav__link,
.md-nav--primary > .md-nav__list > .md-nav__item--section.md-nav__item--active > .md-nav__link {
  border-radius: 0.72rem;
  margin: 0.2rem 0.22rem;
  padding: 0.4rem 0.68rem;
  color: #fff !important;
  font-weight: 800 !important;
  background: linear-gradient(120deg, var(--brand-2), var(--brand-3), var(--brand-4)) !important;
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.2);
}

.md-nav--primary > .md-nav__list > .md-nav__item--section > .md-nav__link:hover,
.md-nav--primary > .md-nav__list > .md-nav__item--section.md-nav__item--active > .md-nav__link:hover {
  filter: brightness(1.03);
}

/* Fallback: top-level active row in primary sidebar */
.md-nav--primary > .md-nav__list > .md-nav__item--active > .md-nav__link,
.md-nav--primary > .md-nav__list > .md-nav__item--active > label.md-nav__link {
  border-radius: 0.72rem;
  margin: 0.2rem 0.22rem;
  padding: 0.4rem 0.68rem;
  color: #fff !important;
  font-weight: 800 !important;
  background: linear-gradient(120deg, var(--brand-2), var(--brand-3), var(--brand-4)) !important;
  box-shadow: 0 4px 12px rgba(109, 40, 217, 0.2);
}

/* Keep the top primary-nav title ("Learn", etc.) in a gradient box */
.md-sidebar--primary .md-nav--primary > .md-nav__title,
.md-sidebar--primary .md-nav--primary > label.md-nav__title,
.md-sidebar--primary .md-nav--primary .md-nav__title[for="__drawer"] {
  background: linear-gradient(120deg, var(--brand-2), var(--brand-3), var(--brand-4)) !important;
  color: #fff !important;
  border-radius: 0.82rem !important;
  padding: 0.5rem 0.8rem !important;
  margin: 0.4rem 0.45rem 0.65rem !important;
  font-weight: 800 !important;
  box-shadow: 0 6px 14px rgba(109, 40, 217, 0.24) !important;
}

.md-sidebar--primary .md-nav--primary > .md-nav__title .md-nav__icon,
.md-sidebar--primary .md-nav--primary > label.md-nav__title .md-nav__icon,
.md-sidebar--primary .md-nav--primary .md-nav__title[for="__drawer"] .md-nav__icon {
  color: #fff !important;
  opacity: 1 !important;
}

/* Active section title inside primary nav (e.g., "Learn") */
.md-sidebar--primary .md-nav--primary .md-nav__item--active > .md-nav > .md-nav__title,
.md-sidebar--primary .md-nav--primary .md-nav__item--active > .md-nav > label.md-nav__title {
  background: linear-gradient(120deg, var(--brand-2), var(--brand-3), var(--brand-4)) !important;
  color: #fff !important;
  border-radius: 0.82rem !important;
  padding: 0.5rem 0.8rem !important;
  margin: 0.4rem 0.45rem 0.65rem !important;
  font-weight: 800 !important;
  box-shadow: 0 6px 14px rgba(109, 40, 217, 0.24) !important;
}

.md-sidebar--primary .md-nav--primary .md-nav__item--active > .md-nav > .md-nav__title .md-nav__icon,
.md-sidebar--primary .md-nav--primary .md-nav__item--active > .md-nav > label.md-nav__title .md-nav__icon {
  color: #fff !important;
  opacity: 1 !important;
}

[data-md-color-scheme="slate"] .md-nav--primary .md-nav__link,
[data-md-color-scheme="slate"] .md-nav--primary .md-nav__item--nested > .md-nav__link {
  color: #dbe4f3;
}

[data-md-color-scheme="slate"] .md-nav--primary .md-nav__link--active {
  color: #f5f3ff !important;
}

/* Secondary TOC */
.md-nav--secondary .md-nav__title {
  border-radius: 0.76rem;
  font-weight: 800;
  color: #fff !important;
  background: var(--bar-gradient) !important;
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.24);
}

.md-nav--secondary .md-nav__link {
  border-radius: 0.55rem;
  padding: 0.3rem 0.56rem;
}

.md-nav--secondary .md-nav__link:hover,
.md-nav--secondary .md-nav__link--active {
  background: rgba(167, 139, 250, 0.2);
}

[data-md-color-scheme="slate"] .md-nav--secondary .md-nav__link {
  color: #dbe4f3;
}

[data-md-color-scheme="slate"] .md-nav--secondary .md-nav__link:hover,
[data-md-color-scheme="slate"] .md-nav--secondary .md-nav__link--active {
  color: #f8fafc;
  background: rgba(139, 92, 246, 0.18);
}

/* Hero heading cards */
.md-typeset > h1 {
  display: block;
  margin-bottom: 1.45rem !important;
  padding: 1.55rem 1.7rem;
  border-radius: var(--radius-xl);
  border: 1px solid var(--line-soft);
  background:
    radial-gradient(1000px 300px at 8% 0%, rgba(124, 58, 237, 0.2), transparent 62%),
    linear-gradient(160deg, rgba(255, 255, 255, 0.98), rgba(243, 244, 255, 0.94));
  box-shadow: var(--shadow-soft);
}

[data-md-color-scheme="slate"] .md-typeset > h1 {
  background:
    radial-gradient(1000px 300px at 8% 0%, rgba(167, 139, 250, 0.24), transparent 62%),
    linear-gradient(160deg, rgba(43, 30, 82, 0.55), rgba(14, 23, 45, 0.9));
  border-color: var(--line-soft);
  box-shadow: var(--shadow-soft);
}

/* Home hero block */
.home-hero {
  margin-bottom: 1rem;
}

.home-hero__text {
  border-radius: var(--radius-xl);
  padding: 1.6rem;
  border: 1px solid var(--line-soft);
  background:
    radial-gradient(900px 280px at 5% 0%, rgba(124, 58, 237, 0.2), transparent 65%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.97), rgba(243, 244, 255, 0.93));
  box-shadow: var(--shadow-soft);
}

[data-md-color-scheme="slate"] .home-hero__text {
  background:
    radial-gradient(900px 280px at 5% 0%, rgba(167, 139, 250, 0.2), transparent 65%),
    linear-gradient(145deg, rgba(30, 42, 70, 0.86), rgba(16, 24, 43, 0.92));
  box-shadow: var(--shadow-soft);
}

.hero-actions .md-button {
  margin-top: 0.45rem;
  margin-right: 0.5rem;
}

/* Utility strip */
.value-strip {
  display: grid;
  gap: 0.6rem;
  margin: 1rem 0 1.6rem;
  padding: 1rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(124, 58, 237, 0.24);
  background: linear-gradient(120deg, rgba(124, 58, 237, 0.12), rgba(236, 72, 153, 0.09));
}

.value-strip ul {
  margin: 0;
}

/* Card system */
.md-typeset .grid.cards > ul > li,
.audience-grid > ul > li {
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.99), rgba(241, 245, 249, 0.96));
  box-shadow: var(--shadow-soft);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
}

.md-typeset .grid.cards > ul > li:hover,
.audience-grid > ul > li:hover {
  transform: translateY(-4px);
  border-color: rgba(124, 58, 237, 0.36);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.14);
}

[data-md-color-scheme="slate"] .md-typeset .grid.cards > ul > li,
[data-md-color-scheme="slate"] .audience-grid > ul > li {
  border-color: var(--line-soft);
  background:
    linear-gradient(165deg, rgba(167, 139, 250, 0.1), rgba(59, 130, 246, 0.03) 40%, rgba(15, 23, 42, 0.1)),
    linear-gradient(180deg, rgba(24, 35, 60, 0.9), rgba(14, 23, 42, 0.92));
  box-shadow: var(--shadow-soft);
}

/* Global quick-links widget */
.quick-links-widget {
  margin: 0.9rem 0 1.1rem;
  border: 1px solid var(--line-soft);
  border-radius: 0.8rem;
  background: rgba(255, 255, 255, 0.42);
}

.quick-links-widget > summary {
  list-style: none;
  cursor: pointer;
  font-weight: 800;
  padding: 0.6rem 0.8rem;
}

.quick-links-widget > summary::-webkit-details-marker {
  display: none;
}

.quick-links-widget__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.2rem 0.8rem 0.8rem;
}

.quick-links-widget__link {
  text-decoration: none;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 0.3rem 0.62rem;
  font-size: 0.78rem;
  background: rgba(255, 255, 255, 0.72);
}

[data-md-color-scheme="slate"] .quick-links-widget {
  background: rgba(24, 35, 60, 0.7);
  border-color: rgba(167, 139, 250, 0.24);
}

[data-md-color-scheme="slate"] .quick-links-widget__link {
  background: rgba(20, 31, 55, 0.88);
  border-color: rgba(167, 139, 250, 0.28);
  color: #e2e8f0;
}

/* Footer */
.md-footer {
  background: transparent !important;
}

.custom-footer,
.md-footer-meta {
  color: #fff !important;
  background: var(--bar-gradient) !important;
}

.custom-footer {
  padding: 1.8rem 1rem 1.2rem !important;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.custom-footer__inner {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.3rem 2rem;
  padding: 1.2rem 1.4rem;
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.13);
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.3);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

[data-md-color-scheme="slate"] .custom-footer__inner {
  border-color: rgba(196, 181, 253, 0.32);
  background: linear-gradient(145deg, rgba(38, 28, 77, 0.44), rgba(27, 40, 74, 0.48));
  box-shadow: 0 16px 36px rgba(2, 6, 23, 0.32);
}

[data-md-color-scheme="slate"] .custom-footer {
  background:
    radial-gradient(120% 160% at 0% 100%, rgba(124, 58, 237, 0.12), transparent 58%),
    radial-gradient(120% 160% at 100% 0%, rgba(167, 139, 250, 0.14), transparent 55%),
    linear-gradient(145deg, #0f1730 0%, #141b35 52%, #1b1f45 100%) !important;
  border-top-color: rgba(167, 139, 250, 0.22);
}

[data-md-color-scheme="slate"] .md-footer-meta {
  background: var(--bar-gradient) !important;
  border-top: 1px solid rgba(196, 181, 253, 0.25);
  box-shadow: 0 -8px 20px rgba(2, 6, 23, 0.3) inset;
}

.custom-footer__right {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.8rem 1rem;
}

.custom-footer__brand {
  font-size: 0.85rem;
  font-weight: 800;
}

.custom-footer__title {
  font-size: 1.1rem;
  font-weight: 800;
}

.custom-footer__subtitle,
.custom-footer__note,
.footer-link {
  font-size: 0.82rem;
}

.custom-footer__form {
  display: flex;
  gap: 0.5rem;
  max-width: 560px;
  margin-top: 0.7rem;
  padding: 0.45rem 0.55rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.14);
}

[data-md-color-scheme="slate"] .custom-footer__form {
  border-color: rgba(167, 139, 250, 0.34);
  background: rgba(49, 59, 95, 0.92);
  box-shadow: none;
}

.custom-footer__input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: #fff;
}

[data-md-color-scheme="slate"] .custom-footer__input {
  background: rgba(20, 31, 55, 0.85);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  color: #f8fafc;
}

.custom-footer__input::placeholder {
  color: rgba(255, 255, 255, 0.78);
}

.custom-footer__button {
  border: 0;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: #0f172a;
}

[data-md-color-scheme="slate"] .custom-footer__button {
  background: rgba(15, 25, 46, 0.95);
  color: #f8fafc;
  border: 1px solid rgba(167, 139, 250, 0.34);
}

.footer-col__title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 800;
}

.footer-link {
  color: rgba(255, 255, 255, 0.93);
  text-decoration: none;
  line-height: 1.5;
  display: block;
  padding: 0.15rem 0;
}

.footer-link:hover {
  color: #fff;
  text-decoration: underline;
}

[data-md-color-scheme="slate"] .footer-link {
  color: rgba(233, 213, 255, 0.95);
}

@media (max-width: 900px) {
  .custom-footer__inner {
    grid-template-columns: 1fr;
  }

  .custom-footer__right {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .custom-footer__right {
    grid-template-columns: 1fr;
  }
}

/* Mobile drawer + compact header actions */
@media (max-width: 1219px) {
  .md-sidebar--primary {
    background: var(--bg-page) !important;
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.28) !important;
  }

  [data-md-color-scheme="slate"] .md-sidebar--primary {
    background: #0b1020 !important;
    box-shadow: 0 20px 42px rgba(2, 6, 23, 0.66) !important;
  }

  .md-sidebar--primary .md-sidebar__scrollwrap,
  .md-sidebar--primary .md-sidebar__inner,
  .md-sidebar--primary .md-nav,
  .md-sidebar--primary .md-nav__list,
  .md-sidebar--primary .md-nav__source {
    background: var(--bg-page) !important;
  }

  [data-md-color-scheme="slate"] .md-sidebar--primary .md-sidebar__scrollwrap,
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-sidebar__inner,
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav,
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__list,
  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__source {
    background: #0b1020 !important;
  }

  .md-sidebar--primary .md-nav__item > .md-nav__link {
    background: var(--bg-page) !important;
  }

  [data-md-color-scheme="slate"] .md-sidebar--primary .md-nav__item > .md-nav__link {
    background: #0b1020 !important;
  }
}

@media (max-width: 700px) {
  .header-toggle-btn,
  .header-github {
    display: none;
  }

  .header-actions {
    gap: 0.38rem;
    margin-left: 0.35rem;
  }

  .header-cta {
    padding: 0 0.72rem;
    font-size: 0.74rem;
  }

  [dir="rtl"] .header-actions {
    margin-right: 0.35rem;
  }
}

/* Embedded iframes */
.iframe-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 0.84rem;
}

.iframe-wrap iframe {
  width: 100%;
  height: clamp(520px, 72vh, 920px);
  border: 0;
  display: block;
}

@media (max-width: 700px) {
  .iframe-wrap iframe {
    height: clamp(460px, 64vh, 760px);
  }
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Focus + motion safety */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
