:root {
  color-scheme: light;
  --bg-spot-left: rgba(103, 214, 255, 0.16);
  --bg-spot-right: rgba(214, 255, 63, 0.16);
  --bg-grad-start: #f7fbff;
  --bg-grad-mid: #eef4f8;
  --bg-grad-end: #e6edf3;
  --bg-grid: rgba(15, 23, 42, 0.045);
  --bg-mask: rgba(15, 23, 42, 0.14);
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.88);
  --topbar-bg: rgba(255, 255, 255, 0.72);
  --line: rgba(15, 23, 42, 0.09);
  --line-strong: rgba(15, 23, 42, 0.16);
  --text: #111827;
  --muted: #586273;
  --accent: #9ecb19;
  --accent-soft: rgba(158, 203, 25, 0.15);
  --accent-text: #6f8d0f;
  --accent-cyan: #36a8df;
  --button-primary-text: #162100;
  --button-surface: rgba(255, 255, 255, 0.58);
  --hover-surface: rgba(15, 23, 42, 0.06);
  --active-surface: rgba(15, 23, 42, 0.08);
  --card-glow: rgba(103, 214, 255, 0.1);
  --shadow: 0 22px 60px rgba(82, 99, 124, 0.16);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --content-width: 1220px;
  --font-display: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-body: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

:root[data-theme-resolved="dark"] {
  color-scheme: dark;
  --bg-spot-left: rgba(103, 214, 255, 0.18);
  --bg-spot-right: rgba(214, 255, 63, 0.12);
  --bg-grad-start: #0c0d11;
  --bg-grad-mid: #090a0d;
  --bg-grad-end: #06070a;
  --bg-grid: rgba(255, 255, 255, 0.03);
  --bg-mask: rgba(255, 255, 255, 0.42);
  --panel: rgba(17, 19, 24, 0.86);
  --panel-strong: rgba(18, 21, 28, 0.96);
  --topbar-bg: rgba(10, 11, 15, 0.78);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f5f7fb;
  --muted: #9aa3b2;
  --accent: #d6ff3f;
  --accent-soft: rgba(214, 255, 63, 0.14);
  --accent-text: #dff5a1;
  --accent-cyan: #67d6ff;
  --button-primary-text: #14180d;
  --button-surface: rgba(255, 255, 255, 0.04);
  --hover-surface: rgba(255, 255, 255, 0.06);
  --active-surface: rgba(255, 255, 255, 0.08);
  --card-glow: rgba(103, 214, 255, 0.12);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme-resolved]) {
    color-scheme: dark;
    --bg-spot-left: rgba(103, 214, 255, 0.18);
    --bg-spot-right: rgba(214, 255, 63, 0.12);
    --bg-grad-start: #0c0d11;
    --bg-grad-mid: #090a0d;
    --bg-grad-end: #06070a;
    --bg-grid: rgba(255, 255, 255, 0.03);
    --bg-mask: rgba(255, 255, 255, 0.42);
    --panel: rgba(17, 19, 24, 0.86);
    --panel-strong: rgba(18, 21, 28, 0.96);
    --topbar-bg: rgba(10, 11, 15, 0.78);
    --line: rgba(255, 255, 255, 0.09);
    --line-strong: rgba(255, 255, 255, 0.18);
    --text: #f5f7fb;
    --muted: #9aa3b2;
    --accent: #d6ff3f;
    --accent-soft: rgba(214, 255, 63, 0.14);
    --accent-text: #dff5a1;
    --accent-cyan: #67d6ff;
    --button-primary-text: #14180d;
    --button-surface: rgba(255, 255, 255, 0.04);
    --hover-surface: rgba(255, 255, 255, 0.06);
    --active-surface: rgba(255, 255, 255, 0.08);
    --card-glow: rgba(103, 214, 255, 0.12);
    --shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, var(--bg-spot-left), transparent 28%),
    radial-gradient(circle at top right, var(--bg-spot-right), transparent 24%),
    linear-gradient(180deg, var(--bg-grad-start) 0%, var(--bg-grad-mid) 36%, var(--bg-grad-end) 100%);
  color: var(--text);
  font-family: var(--font-body);
}

body {
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, var(--bg-mask), transparent 85%);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

.site-shell {
  position: relative;
  z-index: 1;
  padding: 24px;
}

.topbar {
  position: relative;
  z-index: 20;
  overflow: visible;
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--topbar-bg);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.brand img {
  width: 34px;
  height: 34px;
}

.brand span {
  white-space: nowrap;
}

.topnav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topnav a {
  padding: 10px 14px;
  border-radius: 999px;
  color: var(--muted);
  transition: 160ms ease;
}

.topnav a:hover {
  color: var(--text);
  background: var(--hover-surface);
}

.topnav a[aria-current="page"] {
  color: var(--text);
  background: var(--active-surface);
}

.topnav-dropdown {
  position: relative;
}

.topnav-trigger {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--button-surface);
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: 160ms ease;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.topnav-trigger:hover,
.topnav-dropdown[data-open="true"] .topnav-trigger {
  color: var(--text);
  background: var(--hover-surface);
}

.topnav-trigger-arrow {
  width: 8px;
  height: 8px;
  margin-top: -2px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.topnav-dropdown[data-open="true"] .topnav-trigger-arrow {
  transform: rotate(225deg);
  margin-top: 2px;
}

.topnav-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  min-width: 132px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms ease;
  display: grid;
  gap: 4px;
  z-index: 30;
}

.topnav-dropdown[data-open="true"] .topnav-panel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.topnav-option {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 700;
  text-align: left;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: 160ms ease;
}

.topnav-option:hover {
  color: var(--text);
  background: var(--hover-surface);
}

.topnav-option[data-selected="true"],
.topnav-option[aria-current="page"] {
  color: var(--text);
  background: var(--active-surface);
}

.menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--button-surface);
  color: var(--text);
}

.menu-toggle span {
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.portal-main {
  width: min(100%, var(--content-width));
  margin: 28px auto 0;
  display: grid;
  gap: 28px;
}

.portal-main-sections {
  gap: 34px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  font-weight: 700;
}

.section-heading h2,
.not-found h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.section-heading h2 {
  font-size: clamp(1.6rem, 2.8vw, 2.4rem);
  line-height: 1.02;
}

.lede {
  max-width: 64ch;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.8;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.button,
.card-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease, color 160ms ease;
}

.button:hover,
.card-actions a:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--accent);
  color: var(--button-primary-text);
}

.button-secondary,
.card-actions a {
  border: 1px solid var(--line-strong);
  background: var(--button-surface);
}

.info-card,
.feature-card,
.search-shell,
.not-found {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.feature-card h3,
.info-card h3 {
  margin: 0;
  font-size: clamp(2rem, 2.4vw, 2.45rem);
  font-weight: 700;
  line-height: 1.04;
}

.plain-list,
.card-tags {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
}

.feature-card p,
.info-card p,
.plain-list li,
.search-fallback {
  color: var(--muted);
  line-height: 1.75;
}

.section-block {
  display: grid;
  gap: 18px;
}

.section-heading {
  display: grid;
  gap: 10px;
}

.section-heading p {
  margin-bottom: 0;
}

.section-heading-inline {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 16px;
}

.section-heading-copy {
  display: grid;
  gap: 10px;
}

.section-heading-action {
  justify-self: start;
}

.card-grid,
.split-grid {
  display: grid;
  gap: 18px;
}

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

.card-grid-projects {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-grid-knowledge {
  grid-template-columns: minmax(340px, 1.08fr) minmax(280px, 0.92fr);
}

.feature-card,
.info-card {
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.feature-card-link {
  display: block;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.feature-card-link:hover,
.feature-card-link:focus-visible {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.feature-card-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.feature-card::after {
  content: "";
  position: absolute;
  inset: auto -10% -40% auto;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, var(--card-glow), transparent 72%);
  pointer-events: none;
}

.feature-card-active {
  border-color: rgba(214, 255, 63, 0.22);
  background:
    linear-gradient(180deg, rgba(214, 255, 63, 0.06), transparent 40%),
    var(--panel-strong);
}

.feature-card-project {
  min-height: 278px;
}

.card-kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card-tags li {
  padding: 7px 11px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 0.86rem;
}

.feature-card-headline {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.feature-card-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  letter-spacing: 0.04em;
}

.feature-card-blog h3 {
  font-size: 1.85rem;
  line-height: 1.05;
}

.feature-card-blog p {
  font-size: 0.98rem;
}

.section-split .split-grid {
  margin-top: 4px;
}

.search-shell {
  padding: 28px;
}

.search-mount {
  min-height: 240px;
}

.search-intro {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.search-copy {
  display: grid;
  gap: 10px;
}

.search-copy h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 4vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.search-tips-card {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top right, var(--accent-soft), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01)),
    var(--panel-strong);
  box-shadow: var(--shadow);
}

.search-tips-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}

.search-fallback {
  margin: 16px 0 0;
}

.not-found {
  width: min(100% - 48px, 720px);
  margin: 56px auto;
  padding: 40px;
  text-align: center;
}

.not-found p {
  color: var(--muted);
  line-height: 1.8;
}

.not-found .card-actions {
  justify-content: center;
}

.pagefind-ui {
  color: var(--text);
  font-family: var(--font-body);
}

.search-shell .pagefind-ui__form {
  position: relative;
}

.search-shell .pagefind-ui__search-input {
  height: 64px !important;
  padding-inline: 52px 52px !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 20px !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.025)),
    var(--panel-strong) !important;
  color: var(--text) !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 10px 24px rgba(0, 0, 0, 0.12) !important;
}

.search-shell .pagefind-ui__search-input::placeholder {
  color: #788190;
}

.search-shell .pagefind-ui__search-clear,
.search-shell .pagefind-ui__search-clear:focus,
.search-shell .pagefind-ui__search-clear:hover {
  color: var(--muted) !important;
}

.search-shell .pagefind-ui__search-icon {
  color: var(--muted) !important;
}

.pagefind-ui__drawer {
  margin-top: 18px;
}

.pagefind-ui__result {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}

.pagefind-ui__result-link,
.pagefind-ui__result-title {
  color: var(--text);
  font-weight: 700;
}

.pagefind-ui__result-excerpt,
.pagefind-ui__message,
.pagefind-ui__result-nested {
  color: var(--muted);
}

.pagefind-ui__button {
  border-radius: 999px;
  background: var(--button-surface);
  color: var(--text);
}

@media (max-width: 1024px) {
  .card-grid,
  .split-grid {
    grid-template-columns: 1fr;
  }

  .search-intro {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .site-shell {
    padding: 16px;
  }

  .topbar {
    border-radius: 28px;
    align-items: flex-start;
    flex-wrap: wrap;
  }

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

  .topnav {
    display: none;
    width: 100%;
    padding-top: 8px;
    flex-direction: column;
    align-items: stretch;
  }

  .topnav.is-open {
    display: flex;
  }

  .topnav a {
    width: 100%;
  }

  .topnav-dropdown {
    width: 100%;
  }

  .topnav-trigger {
    width: 100%;
    justify-content: space-between;
  }

  .topnav-panel {
    position: static;
    margin-top: 8px;
    min-width: 0;
    transform: none;
  }

  .topnav-dropdown:not([data-open="true"]) .topnav-panel {
    display: none;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .section-heading-inline {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .section-heading h2,
  .not-found h1 {
    letter-spacing: -0.03em;
  }

  .search-shell,
  .feature-card,
  .info-card,
  .not-found {
    padding: 20px;
  }
}
