/* USTC LLM Platform documentation design system */
:root,
[data-md-color-scheme="default"] {
  --docs-brand-950: #0b2a4f;
  --docs-brand-900: #123b72;
  --docs-brand-800: #174f91;
  --docs-brand-700: #2468b5;
  --docs-accent: #2f7de1;
  --docs-accent-soft: #eaf3ff;
  --docs-bg: #f3f6fa;
  --docs-surface: #ffffff;
  --docs-surface-soft: #f7f9fc;
  --docs-text: #172033;
  --docs-text-muted: #5b687a;
  --docs-border: #dfe6ef;
  --docs-shell: 1760px;
  --docs-toc: 272px;
  --docs-radius: 18px;
  --docs-shadow: 0 14px 42px rgba(20, 45, 80, .07);
  --md-primary-fg-color: var(--docs-brand-900);
  --md-accent-fg-color: var(--docs-accent);
  --md-typeset-a-color: #1769c2;
}

[data-md-color-scheme="slate"] {
  --docs-bg: #0c1522;
  --docs-surface: #121e2d;
  --docs-surface-soft: #172638;
  --docs-text: #e8eef6;
  --docs-text-muted: #a5b2c3;
  --docs-border: #293a50;
  --docs-accent-soft: #15304f;
  --docs-shadow: 0 14px 42px rgba(0, 0, 0, .22);
}

/* Material already applies the sticky header offset to heading targets.
   Adding a second scroll-padding offset makes TOC links stop one section early. */
html {
  scroll-padding-top: 0;
}

/* Keep the selected heading just inside Material's active-section threshold.
   The value tracks the 72px header + 56px tabs without adding a second offset. */
html .md-typeset :target {
  scroll-margin-top: 127px !important;
}

body,
input {
  font-family: "Noto Sans SC", "Source Han Sans SC", "PingFang SC",
    "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

body,
.md-main {
  background: var(--docs-bg);
}

.md-grid {
  width: 100%;
  max-width: var(--docs-shell);
}

/* Brand header */
.md-header {
  height: auto;
  background: linear-gradient(110deg, var(--docs-brand-950), var(--docs-brand-900) 58%, #205da8);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .1);
}

.md-header__inner {
  min-height: 60px;
  padding-inline: clamp(24px, 3vw, 52px);
}

.md-header__button.md-logo {
  margin: 0 12px 0 0;
  padding: 6px;
}

.md-header__button.md-logo svg,
.md-header__button.md-logo img {
  width: 32px;
  height: 32px;
}

.md-header__title {
  margin-left: 0;
  font-size: clamp(21px, 1.35vw, 26px);
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: .01em;
}

.md-header__topic {
  font-weight: inherit;
}

.md-header__ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
}

@media screen and (min-width: 60em) {
  .md-search {
    width: min(340px, 25vw);
    margin-left: auto;
  }

  .md-search__form {
    height: 40px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 9px;
    background: rgba(4, 18, 45, .3);
    transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
  }

  .md-search__form:hover,
  .md-search__form:focus-within {
    border-color: rgba(255, 255, 255, .38);
    background: rgba(4, 18, 45, .42);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, .08);
  }

  .md-search__input {
    height: 40px;
    padding-left: 44px;
    font-size: 16px;
  }

  .md-search__icon {
    top: 8px;
    left: 12px;
  }
}

/* Primary tabs */
.md-tabs {
  height: 46px;
  overflow-y: hidden;
  border-top: 1px solid rgba(255, 255, 255, .07);
  background: var(--docs-brand-800);
  scrollbar-width: none;
}

.md-tabs::-webkit-scrollbar,
.md-tabs::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.md-tabs > .md-grid {
  height: 100%;
  padding-inline: clamp(24px, 3vw, 52px);
}

.md-tabs__list {
  height: 100%;
  gap: 4px;
}

.md-tabs__item {
  height: 100%;
  padding: 0;
}

.md-tabs__link {
  display: flex;
  align-items: center;
  box-sizing: border-box;
  height: 100%;
  margin: 0;
  padding: 0 15px;
  border-bottom: 2px solid transparent;
  font-size: 17px;
  font-weight: 650;
  opacity: .78;
  transition: color .16s ease, opacity .16s ease, border-color .16s ease, background .16s ease;
}

.md-tabs__link:hover,
.md-tabs__link:focus,
.md-tabs__link--active {
  border-bottom-color: #fff;
  background: rgba(255, 255, 255, .06);
  opacity: 1;
}

/* Wide content shell */
.md-main__inner {
  align-items: flex-start;
  gap: 34px;
  width: 100%;
  max-width: var(--docs-shell);
  margin: 0 auto;
  padding: 34px clamp(24px, 3vw, 52px) 72px;
}

.md-content {
  min-width: 0;
  max-width: none;
  margin: 0;
}

.md-content__inner {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(36px, 3vw, 58px) clamp(34px, 4vw, 68px) 72px;
  border: 1px solid var(--docs-border);
  border-radius: var(--docs-radius);
  background: var(--docs-surface);
  box-shadow: var(--docs-shadow);
}

.md-content__inner::before {
  display: none;
}

@media screen and (min-width: 76.25em) {
  /* Top-level tabs are the desktop navigation; the one-item left rail is redundant. */
  .md-sidebar--primary {
    display: none;
  }

  .md-sidebar--secondary {
    display: block;
    flex: 0 0 var(--docs-toc);
    width: var(--docs-toc);
    padding: 0;
  }

  .md-sidebar--secondary .md-sidebar__scrollwrap {
    margin: 0;
    padding: 14px;
    border: 1px solid var(--docs-border);
    border-radius: 14px;
    background: rgba(255, 255, 255, .82);
    box-shadow: 0 8px 28px rgba(20, 45, 80, .045);
    backdrop-filter: blur(10px);
  }

  [data-md-color-scheme="slate"] .md-sidebar--secondary .md-sidebar__scrollwrap {
    background: rgba(18, 30, 45, .9);
  }

  .md-sidebar--secondary .md-sidebar__inner {
    padding: 0;
  }
}

/* Navigation and table of contents */
.md-nav {
  font-size: 18px;
}

.md-nav__title {
  padding: 9px 10px;
  background: transparent;
  color: var(--docs-text);
  font-size: 20px;
  font-weight: 750;
}

.md-nav__link {
  margin: 2px 0;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--docs-text-muted);
  line-height: 1.45;
}

.md-nav__link:hover {
  background: var(--docs-surface-soft);
  color: var(--docs-accent);
}

.md-nav__link--active {
  background: var(--docs-accent-soft);
  color: var(--docs-accent);
  font-weight: 700;
}

/* Typography */
.md-typeset {
  color: var(--docs-text);
  font-size: clamp(20px, .3vw + 16px, 22px);
  line-height: 1.8;
  letter-spacing: .005em;
}

.md-typeset > p,
.md-typeset > ul,
.md-typeset > ol,
.md-typeset > blockquote {
  max-width: 88ch;
}

.md-typeset h1 {
  margin: 0 0 30px;
  color: var(--docs-text);
  font-size: clamp(46px, 2.7vw, 56px);
  font-weight: 780;
  line-height: 1.18;
  letter-spacing: -.03em;
}

.md-typeset h2 {
  margin: 54px 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--docs-border);
  color: var(--docs-text);
  font-size: clamp(33px, 1.9vw, 38px);
  font-weight: 740;
  line-height: 1.3;
  letter-spacing: -.015em;
}

.md-typeset h3 {
  margin: 36px 0 12px;
  color: var(--docs-text);
  font-size: clamp(25px, 1.45vw, 29px);
  font-weight: 720;
  line-height: 1.4;
}

.md-typeset h4 {
  color: var(--docs-text);
  font-size: 21px;
  font-weight: 700;
}

.md-typeset p,
.md-typeset li {
  font-size: 1em;
  line-height: 1.8;
}

.md-typeset p {
  margin: .8em 0 1em;
}

.md-typeset strong {
  color: var(--docs-text);
  font-weight: 720;
}

.md-typeset a {
  color: var(--md-typeset-a-color);
  text-underline-offset: 3px;
}

.md-typeset a:hover {
  text-decoration: underline;
}

/* Platform overview hero */
.platform-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr);
  gap: clamp(28px, 4vw, 64px);
  margin: 0 0 44px;
  padding: clamp(30px, 4vw, 56px);
  overflow: hidden;
  border: 1px solid #cfe0f5;
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 12%, rgba(66, 153, 255, .24), transparent 34%),
    linear-gradient(135deg, #edf5ff 0%, #f8fbff 58%, #eef4fb 100%);
  position: relative;
}

.platform-hero::after {
  position: absolute;
  right: -90px;
  bottom: -120px;
  width: 310px;
  height: 310px;
  border: 42px solid rgba(36, 104, 181, .08);
  border-radius: 50%;
  content: "";
}

.platform-hero__content,
.platform-hero__stats {
  position: relative;
  z-index: 1;
}

.platform-hero__eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 14px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(36, 104, 181, .1);
  color: var(--docs-brand-800);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .09em;
}

.platform-hero h2 {
  max-width: 760px;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
  color: var(--docs-brand-950);
  font-size: clamp(31px, 2.15vw, 42px);
  line-height: 1.28;
}

.platform-hero__lead {
  max-width: 760px;
  margin: 0;
  color: #40516a;
  font-size: clamp(19px, .45vw + 14px, 22px);
  line-height: 1.85;
}

.platform-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 26px;
}

.platform-hero__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 9px 18px;
  border: 1px solid #b8cce5;
  border-radius: 10px;
  background: rgba(255, 255, 255, .72);
  color: var(--docs-brand-800) !important;
  font-size: 17px;
  font-weight: 750;
  text-decoration: none !important;
}

.platform-hero__button--primary {
  border-color: var(--docs-brand-800);
  background: var(--docs-brand-800);
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(23, 79, 145, .2);
}

.platform-hero__button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(23, 79, 145, .14);
}

.platform-hero__stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: center;
}

.platform-stat {
  min-height: 118px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .88);
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 10px 28px rgba(25, 65, 110, .07);
}

.platform-stat:last-child {
  grid-column: 1 / -1;
}

.platform-stat strong,
.platform-stat span {
  display: block;
}

.platform-stat strong {
  color: var(--docs-brand-900);
  font-size: clamp(24px, 1.6vw, 32px);
  line-height: 1.15;
}

.platform-stat span {
  margin-top: 9px;
  color: #607087;
  font-size: 16px;
  line-height: 1.45;
}

/* Information blocks */
.key-points {
  max-width: none;
  margin: 24px 0;
  padding: 22px 26px;
  border: 1px solid #cfe0f5;
  border-left: 5px solid var(--docs-accent);
  border-radius: 13px;
  background: var(--docs-accent-soft);
}

.key-points strong {
  color: var(--docs-brand-800);
}

.md-typeset .admonition,
.md-typeset details {
  max-width: none;
  margin: 24px 0;
  padding: 20px 24px;
  border: 1px solid var(--docs-border);
  border-left-width: 5px;
  border-radius: 13px;
  background: var(--docs-surface-soft);
  box-shadow: none;
  font-size: .96em;
}

/* Tables */
.md-typeset__table {
  display: block;
  width: 100%;
  margin: 24px 0 30px;
  overflow-x: auto;
  border: 1px solid var(--docs-border);
  border-radius: 13px;
  background: var(--docs-surface);
}

.md-typeset table:not([class]) {
  display: table;
  width: 100%;
  margin: 0;
  border: 0;
  font-size: 19px;
}

.md-typeset table:not([class]) th {
  padding: 15px 18px;
  background: #eef3f8;
  color: var(--docs-text);
  font-weight: 750;
}

.md-typeset table:not([class]) td {
  padding: 15px 18px;
  border-top: 1px solid var(--docs-border);
}

.md-typeset table:not([class]) tbody tr:hover {
  background: #f8fbff;
}

/* Code */
.md-typeset code,
.md-typeset pre {
  font-family: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

.md-typeset code {
  font-size: .88em;
}

.md-typeset :not(pre) > code {
  padding: .14em .42em;
  border: 1px solid var(--docs-border);
  border-radius: 6px;
  background: var(--docs-surface-soft);
  color: #174f91;
}

.md-typeset .highlight {
  margin: 24px 0;
  overflow: hidden;
  border: 1px solid var(--docs-border);
  border-radius: 13px;
}

.md-typeset pre > code {
  font-size: 17px;
  line-height: 1.7;
}

/* Existing and Material card layouts */
.card-grid,
.name-card-grid,
.md-typeset .grid.cards > ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  max-width: none;
  margin: 24px 0 32px;
}

.card,
.name-card,
.md-typeset .grid.cards > ul > li {
  padding: 22px 24px;
  border: 1px solid var(--docs-border);
  border-radius: 14px;
  background: var(--docs-surface);
  box-shadow: 0 7px 24px rgba(20, 45, 80, .05);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.card {
  display: block;
  color: inherit !important;
  text-decoration: none !important;
}

.card:hover,
.name-card:hover,
.md-typeset .grid.cards > ul > li:hover {
  transform: translateY(-2px);
  border-color: #9fc2ed;
  box-shadow: 0 12px 30px rgba(20, 45, 80, .09);
}

.card h3,
.name-card h4 {
  margin-top: 0;
  color: var(--docs-brand-900);
}

/* Legacy vertical flow blocks used on workflow and API pages */
.flow {
  max-width: none;
  margin: 24px 0 30px;
  padding: 22px 26px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 14px;
  background: linear-gradient(135deg, #102f56, #184b83);
  color: #f8fbff;
  font-family: "JetBrains Mono", "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  font-size: 18px;
  line-height: 1.9;
  white-space: pre-line;
}

.flow p {
  max-width: none !important;
  margin: 0;
  color: inherit;
  font: inherit;
  line-height: inherit;
}

/* Horizontal service flow on the redesigned overview page */
.flow-steps {
  display: grid;
  grid-template-columns: repeat(9, auto);
  align-items: stretch;
  gap: 12px;
  max-width: none;
  margin: 24px 0 30px;
  padding: 24px;
  border-radius: 16px;
  background: linear-gradient(135deg, #102f56, #184b83);
  color: #fff;
}

.flow-steps--3 {
  grid-template-columns: 1fr auto 1fr auto 1fr;
}

.flow-steps--4 {
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
}

.flow-steps--5 {
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr auto 1fr;
}

.flow-step {
  display: flex;
  min-width: 130px;
  flex-direction: column;
  justify-content: center;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 12px;
  background: rgba(255, 255, 255, .07);
}

.flow-step span,
.flow-step strong,
.flow-step small {
  display: block;
}

.flow-step span {
  color: #8ec7ff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .08em;
}

.flow-step strong {
  margin-top: 8px;
  color: #fff;
  font-size: 18px;
}

.flow-step small {
  margin-top: 4px;
  color: rgba(255, 255, 255, .68);
  font-size: 14px;
}

.flow-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8ec7ff;
  font-size: 22px;
}

/* Footer */
.md-footer {
  background: var(--docs-brand-950);
}

.md-footer-meta {
  background: #071e39;
}

:focus-visible {
  outline: 3px solid rgba(47, 125, 225, .48);
  outline-offset: 3px;
}

/* Tablet: top tabs collapse into the navigation drawer. */
@media screen and (max-width: 76.234375em) {
  html {
    scroll-padding-top: 0;
  }

  html .md-typeset :target {
    scroll-margin-top: 55px !important;
  }

  .md-header__inner {
    min-height: 56px;
    padding-inline: 14px;
  }

  .md-header__title {
    font-size: clamp(18px, 2vw, 22px);
  }

  .md-main__inner {
    padding: 24px 20px 52px;
  }

  .md-content__inner {
    padding: 38px 34px 56px;
  }

  .platform-hero {
    grid-template-columns: 1fr;
  }

  .platform-hero__stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .platform-stat:last-child {
    grid-column: auto;
  }

  .flow-steps {
    grid-template-columns: repeat(3, 1fr);
  }

  .flow-arrow {
    display: none;
  }
}

@media screen and (max-width: 44.984375em) {
  html {
    scroll-padding-top: 0;
  }

  html .md-typeset :target {
    scroll-margin-top: 53px !important;
  }

  .md-header__inner {
    min-height: 54px;
  }

  .md-header__button.md-logo svg,
  .md-header__button.md-logo img {
    width: 25px;
    height: 25px;
  }

  .md-header__title {
    font-size: 17px;
  }

  .md-main__inner {
    padding: 0;
  }

  .md-content__inner {
    padding: 30px 18px 48px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .md-typeset {
    font-size: 19px;
    line-height: 1.75;
  }

  .md-typeset h1 {
    margin-bottom: 22px;
    font-size: 38px;
  }

  .md-typeset h2 {
    margin-top: 42px;
    font-size: 29px;
  }

  .md-typeset h3 {
    font-size: 24px;
  }

  .platform-hero {
    gap: 26px;
    margin-inline: -4px;
    padding: 26px 22px;
    border-radius: 16px;
  }

  .platform-hero__stats,
  .card-grid,
  .name-card-grid,
  .md-typeset .grid.cards > ul,
  .flow-steps {
    grid-template-columns: 1fr;
  }

  .platform-stat:last-child {
    grid-column: auto;
  }

  .platform-hero__actions {
    flex-direction: column;
  }

  .platform-hero__button {
    width: 100%;
  }

  .flow-step {
    min-width: 0;
  }

  .md-typeset table:not([class]) {
    font-size: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .md-header,
  .md-tabs,
  .md-sidebar,
  .md-footer {
    display: none !important;
  }

  .md-main,
  .md-content__inner {
    background: #fff;
  }

  .md-content__inner {
    padding: 0;
    border: 0;
    box-shadow: none;
  }
}
