:root {
  --theme-ink: #152238;
  --theme-muted: #65748b;
  --theme-primary: #6d5dfc;
  --theme-secondary: #00b8d9;
  --theme-accent: #ff7a59;
  --theme-surface: rgba(255, 255, 255, 0.78);
  --theme-border: rgba(109, 93, 252, 0.13);
  --theme-shadow: 0 18px 55px rgba(38, 48, 89, 0.12);
  --theme-radius: 18px;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  color: var(--theme-ink);
  background: #f5f7ff;
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  content: "";
}

body::before {
  background:
    radial-gradient(circle at 8% 18%, rgba(0, 184, 217, 0.17), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(109, 93, 252, 0.18), transparent 27%),
    radial-gradient(circle at 72% 82%, rgba(255, 122, 89, 0.12), transparent 30%);
  filter: blur(2px);
  animation: ambient-drift 16s ease-in-out infinite alternate;
}

body::after {
  z-index: -1;
  opacity: 0.25;
  background-image:
    linear-gradient(rgba(109, 93, 252, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(109, 93, 252, 0.06) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

a {
  transition: color 0.22s ease, opacity 0.22s ease;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  margin: 0;
  padding-top: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(109, 93, 252, 0.1);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 30px rgba(38, 48, 89, 0.06);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  transition: padding 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.site-header.is-scrolled {
  padding-top: 8px;
  padding-bottom: 8px;
  background: rgba(255, 255, 255, 0.91);
  box-shadow: 0 12px 36px rgba(38, 48, 89, 0.12);
}

.site-header h1 a {
  position: relative;
  color: var(--theme-ink);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-decoration: none;
}

.site-header h1 .octicon {
  color: var(--theme-primary);
  filter: drop-shadow(0 0 10px rgba(109, 93, 252, 0.35));
  transition: transform 0.35s ease;
}

.site-header h1 a:hover .octicon {
  transform: rotate(-10deg) scale(1.12);
}

.site-header-nav {
  margin-bottom: -14px;
}

.site-header-nav-item {
  position: relative;
  margin-left: 0.65rem;
  padding: 8px 12px 17px;
  color: #536179;
  border-radius: 10px 10px 0 0;
  transition: color 0.22s ease, transform 0.22s ease, background 0.22s ease;
}

.site-header-nav-item::after {
  position: absolute;
  right: 12px;
  bottom: 10px;
  left: 12px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--theme-secondary), var(--theme-primary));
  content: "";
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.25s ease;
}

.site-header-nav-item:hover,
.site-header-nav-item.selected {
  color: var(--theme-primary);
  border-bottom: 0;
  background: rgba(109, 93, 252, 0.07);
  transform: translateY(-1px);
}

.site-header-nav-item:hover::after,
.site-header-nav-item.selected::after {
  transform: scaleX(1);
}

.home .site-header {
  color: #fff;
  border-bottom-color: rgba(255, 255, 255, 0.13);
  background: rgba(20, 25, 55, 0.82);
}

.home .site-header.is-scrolled {
  background: rgba(20, 25, 55, 0.93);
}

.home .site-header h1 a,
.home .site-header .site-header-nav-item {
  color: rgba(255, 255, 255, 0.82);
}

.home .site-header .site-header-nav-item:hover,
.home .site-header .site-header-nav-item.selected {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.home .banner {
  position: relative;
  overflow: hidden;
  margin-bottom: 34px;
  color: #fff;
  background: linear-gradient(125deg, #151937, #4338ca, #007f9e, #6d5dfc);
  background-size: 300% 300%;
  animation: aurora-flow 13s ease infinite;
}

.home .banner::before,
.home .banner::after {
  position: absolute;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  content: "";
  pointer-events: none;
  filter: blur(4px);
}

.home .banner::before {
  top: -190px;
  right: 8%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  box-shadow: 0 0 90px rgba(0, 229, 255, 0.25), inset 0 0 70px rgba(255, 255, 255, 0.08);
  animation: orb-float 9s ease-in-out infinite;
}

.home .banner::after {
  bottom: -245px;
  left: 4%;
  background: rgba(255, 122, 89, 0.22);
  box-shadow: 0 0 100px rgba(255, 122, 89, 0.35);
  animation: orb-float 11s ease-in-out -3s infinite reverse;
}

.home .banner .collection-head {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 82px 0 88px;
  color: #fff;
  background: transparent !important;
  box-shadow: none;
}

.home .collection-title {
  animation: hero-arrive 0.85s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.home .collection-head .collection-header {
  max-width: 720px;
  margin-bottom: 16px;
  font-size: clamp(30px, 5vw, 58px);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: 0.02em;
  text-wrap: balance;
  text-shadow: 0 14px 38px rgba(9, 14, 48, 0.3);
}

.home .collection-head .collection-header span {
  background: linear-gradient(90deg, #fff, #aaf5ff, #ffd8c8, #fff);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: title-shimmer 5s linear infinite;
}

.home .collection-info {
  color: rgba(255, 255, 255, 0.82);
}

.home .collection-info a {
  color: #fff;
}

.collection-head.small {
  position: relative;
  overflow: hidden;
  margin-top: 0;
  margin-bottom: 32px;
  padding: 34px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(120deg, #17213f, #4939b8 52%, #0089a8) !important;
  background-size: 180% 180% !important;
  box-shadow: 0 18px 48px rgba(41, 43, 102, 0.2);
  animation: aurora-flow 14s ease infinite;
}

.collection-head.small::after {
  position: absolute;
  top: -90px;
  right: 8%;
  width: 220px;
  height: 220px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  box-shadow: inset 0 0 60px rgba(255, 255, 255, 0.08);
  content: "";
}

.collection-head.small .container {
  position: relative;
  z-index: 1;
}

.collection-head.small .collection-title h1.collection-header {
  font-weight: 700;
  letter-spacing: 0.02em;
  text-shadow: 0 8px 28px rgba(5, 10, 36, 0.35);
  animation: hero-arrive 0.7s ease both;
}

.content {
  position: relative;
  z-index: 2;
}

.repo-list-item {
  overflow: hidden;
  margin-bottom: 18px;
  padding: 25px 26px;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  background: var(--theme-surface);
  box-shadow: 0 8px 26px rgba(38, 48, 89, 0.07);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.3s ease, border-color 0.3s ease;
}

.repo-list-item::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 4px;
  background: linear-gradient(180deg, var(--theme-secondary), var(--theme-primary), var(--theme-accent));
  content: "";
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.3s ease;
}

.repo-list-item:hover {
  border-color: rgba(109, 93, 252, 0.3);
  box-shadow: 0 22px 55px rgba(42, 46, 105, 0.16);
  transform: translateY(-6px) translateX(2px);
}

.repo-list-item:hover::before {
  transform: scaleY(1);
}

.repo-list-name {
  font-size: 22px;
  font-weight: 700;
}

.repo-list-name a {
  color: var(--theme-ink);
  background-image: linear-gradient(90deg, var(--theme-primary), var(--theme-secondary));
  background-position: 0 100%;
  background-repeat: no-repeat;
  background-size: 0 2px;
  text-decoration: none;
  transition: color 0.25s ease, background-size 0.3s ease;
}

.repo-list-item:hover .repo-list-name a {
  color: var(--theme-primary);
  background-size: 100% 2px;
}

.repo-list-description {
  color: var(--theme-muted);
  line-height: 1.75;
}

.repo-list-meta .meta-info {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(109, 93, 252, 0.07);
}

.top-most-flag {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 7px;
  color: #fff;
  font-size: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--theme-accent), #ff477e);
  box-shadow: 0 5px 14px rgba(255, 71, 126, 0.24);
}

.content > .columns > .column.one-third,
.content > .columns > .column.one-fourth {
  position: sticky;
  top: 92px;
  padding: 22px;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 38px rgba(38, 48, 89, 0.08);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
}

.content > .columns > .column.one-third h3,
.content > .columns > .column.one-fourth h3 {
  position: relative;
  margin-top: 6px;
  padding-left: 14px;
  color: var(--theme-ink);
}

.content > .columns > .column.one-third h3::before,
.content > .columns > .column.one-fourth h3::before {
  position: absolute;
  top: 0.25em;
  bottom: 0.2em;
  left: 0;
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(var(--theme-secondary), var(--theme-primary));
  content: "";
}

#search_box {
  box-sizing: border-box;
  width: 100% !important;
  padding: 10px 13px;
  border: 1px solid rgba(109, 93, 252, 0.18);
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: inset 0 1px 2px rgba(30, 42, 80, 0.04);
  transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

#search_box:focus {
  border-color: var(--theme-primary);
  box-shadow: 0 0 0 4px rgba(109, 93, 252, 0.1);
  transform: translateY(-1px);
}

#search_results a,
.content > .columns > .column.one-third > a {
  color: var(--theme-primary) !important;
}

.article-content {
  padding: 38px 42px;
  border: 1px solid var(--theme-border);
  border-radius: var(--theme-radius);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--theme-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.markdown-body h1,
.markdown-body h2 {
  position: relative;
  border-bottom-color: rgba(109, 93, 252, 0.13);
}

.markdown-body h2 {
  padding-left: 15px;
}

.markdown-body h2::before {
  position: absolute;
  top: 0.15em;
  bottom: 0.35em;
  left: 0;
  width: 5px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--theme-secondary), var(--theme-primary));
  content: "";
}

.markdown-body a {
  color: #5848db;
  text-decoration-color: rgba(88, 72, 219, 0.35);
  text-underline-offset: 3px;
}

.markdown-body blockquote {
  border-left: 4px solid var(--theme-primary);
  border-radius: 0 12px 12px 0;
  background: linear-gradient(90deg, rgba(109, 93, 252, 0.09), rgba(0, 184, 217, 0.04));
}

.markdown-body pre,
pre {
  overflow: auto;
  border: 1px solid rgba(128, 149, 190, 0.2);
  border-radius: 14px;
  background: #151a2e;
  box-shadow: 0 12px 30px rgba(16, 22, 48, 0.13);
}

.markdown-body code {
  border-radius: 6px;
}

.markdown-body table {
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(38, 48, 89, 0.06);
}

.post-directory {
  box-sizing: border-box;
  width: 100%;
  max-height: calc(100vh - 190px) !important;
  padding: 8px;
  overflow: auto !important;
  border-color: var(--theme-border);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

#post-directory-module {
  position: static !important;
  top: auto !important;
  width: 100% !important;
}

.post-directory .toc-title {
  display: block;
  padding: 5px 9px 8px;
  border-left: 0;
  color: var(--theme-muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.post-directory .toc,
.post-directory .toc-child {
  margin: 0;
  padding-left: 0;
  list-style: none;
}

.post-directory .toc-child {
  margin-left: 11px;
  padding-left: 10px;
  border-left: 1px solid rgba(109, 93, 252, 0.13);
}

.post-directory .toc-item {
  margin: 2px 0;
  line-height: 1.45;
}

.post-directory .jumper {
  display: block;
  width: 100%;
  padding: 7px 9px;
  color: #65748b;
  border-radius: 8px;
  overflow-wrap: break-word;
  word-break: normal;
  white-space: normal;
}

.post-directory a {
  transition: color 0.2s ease, padding-left 0.2s ease;
}

.post-directory a:hover,
.post-directory a.on {
  padding-left: 13px;
  color: var(--theme-primary);
  background: rgba(109, 93, 252, 0.08);
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  scroll-margin-top: 92px;
}

.markdown-body div.highlight {
  color: #d9e2f2;
  background: transparent;
}

.markdown-body .highlight pre,
.markdown-body pre,
.markdown-body pre code {
  color: #d9e2f2;
}

.markdown-body .highlight pre.highlight {
  background: #151a2e;
}

.highlight .c,
.highlight .ch,
.highlight .cm,
.highlight .cp,
.highlight .cpf,
.highlight .c1,
.highlight .cs {
  color: #7f8da8;
}

.highlight .k,
.highlight .kc,
.highlight .kd,
.highlight .kn,
.highlight .kp,
.highlight .kr,
.highlight .kt,
.highlight .kv,
.highlight .ow {
  color: #ff7ab2;
}

.highlight .s,
.highlight .sa,
.highlight .sb,
.highlight .sc,
.highlight .sd,
.highlight .s1,
.highlight .s2,
.highlight .se,
.highlight .sh,
.highlight .si,
.highlight .sr,
.highlight .sx,
.highlight .dl {
  color: #a8dc76;
}

.highlight .m,
.highlight .mb,
.highlight .mf,
.highlight .mh,
.highlight .mi,
.highlight .mo,
.highlight .mx,
.highlight .il {
  color: #62d6e8;
}

.highlight .na,
.highlight .nb,
.highlight .nc,
.highlight .nd,
.highlight .ne,
.highlight .nf,
.highlight .fm,
.highlight .nl,
.highlight .nn,
.highlight .nt,
.highlight .nv,
.highlight .vc,
.highlight .vg,
.highlight .vi,
.highlight .vm {
  color: #82aaff;
}

.highlight .bp,
.highlight .no,
.highlight .ss {
  color: #ffc777;
}

.highlight .o {
  color: #89ddff;
}

.highlight .p,
.highlight .n,
.highlight .w {
  color: #d9e2f2;
}

.highlight .err {
  color: #ff757f;
  background: transparent;
}

.pagination .btn {
  border-color: rgba(109, 93, 252, 0.2);
  background: rgba(255, 255, 255, 0.8);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pagination .btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(38, 48, 89, 0.1);
}

.pagination a.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--theme-secondary), var(--theme-primary));
}

.site-footer {
  border-top-color: rgba(109, 93, 252, 0.12);
  color: var(--theme-muted);
}

.site-footer .octicon-mark-github {
  color: var(--theme-primary);
  filter: drop-shadow(0 4px 8px rgba(109, 93, 252, 0.22));
  transition: transform 0.3s ease, color 0.3s ease;
}

.site-footer .octicon-mark-github:hover {
  color: var(--theme-secondary);
  transform: translateY(-3px) rotate(-8deg);
}

.tools-wrapper .gotop {
  width: 42px;
  height: 42px;
  line-height: 42px;
  color: #fff;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--theme-secondary), var(--theme-primary));
  box-shadow: 0 12px 28px rgba(77, 71, 190, 0.3);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.tools-wrapper .gotop:hover {
  transform: translateY(-4px) rotate(6deg);
  box-shadow: 0 16px 34px rgba(77, 71, 190, 0.4);
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 2000;
  width: 100%;
  height: 3px;
  pointer-events: none;
}

.reading-progress::after {
  display: block;
  width: calc(var(--reading-progress, 0) * 1%);
  height: 100%;
  border-radius: 0 999px 999px 0;
  background: linear-gradient(90deg, var(--theme-secondary), var(--theme-primary), var(--theme-accent));
  box-shadow: 0 0 12px rgba(0, 184, 217, 0.55);
  content: "";
  transition: width 0.08s linear;
}

.motion-ready .reveal-item {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.22, 1, 0.36, 1);
}

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

@keyframes aurora-flow {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

@keyframes ambient-drift {
  0% { transform: scale(1) translate3d(0, 0, 0); }
  100% { transform: scale(1.08) translate3d(1.5%, -1%, 0); }
}

@keyframes orb-float {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(24px, 20px, 0) scale(1.08); }
}

@keyframes hero-arrive {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes title-shimmer {
  to { background-position: 220% center; }
}

@media (max-width: 50em) {
  .site-header {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .site-header-nav {
    margin-bottom: 4px;
    flex-direction: column;
    align-items: flex-end;
  }

  .site-header-nav-item {
    padding: 7px 10px !important;
    border-radius: 8px;
  }

  .site-header-nav-item::after {
    display: none;
  }

  .home .banner .collection-head {
    padding: 54px 0 60px;
  }

  .home .collection-head .collection-header {
    font-size: 30px;
    line-height: 1.3;
  }

  .content > .columns > .column.one-third,
  .content > .columns > .column.one-fourth {
    position: static;
    margin-top: 24px;
  }

  .article-content {
    padding: 25px 20px;
    border-radius: 14px;
  }

  .repo-list-item {
    padding: 21px 18px;
    border-radius: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .motion-ready .reveal-item {
    opacity: 1;
    transform: none;
  }
}
