/* source: https://github.com/TonyCrane/note/blob/master/docs/css/counter.css */

/* auto numbering */

h1 {
    counter-reset: h2;
  }
  h2 {
    counter-reset: h3;
  }
  h3 {
    counter-reset: h4;
  }
  h4 {
    counter-reset: h5;
  }
  h5 {
    counter-reset: h6;
  }
  h2:before {
    counter-increment: h2;
    content: counter(h2);
    margin-right: 0.8rem;
  }
  h3:before {
    counter-increment: h3;
    content: counter(h2) "." counter(h3);
    margin-right: 0.8rem;
  }
  h4:before {
    counter-increment: h4;
    content: counter(h2) "." counter(h3) "." counter(h4);
    margin-right: 0.8rem;
  }
  h5:before {
    counter-increment: h5;
    content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5);
    margin-right: 0.8rem;
  }
h6:before {
    counter-increment: h6;
    content: counter(h2) "." counter(h3) "." counter(h4) "." counter(h5) "." counter(h6);
    margin-right: 0.8rem;
  }

/* site color system */

[data-md-color-scheme="slate"] {
  --md-default-bg-color: #0b1020;
  --md-default-bg-color--light: #111a2e;
  --md-default-bg-color--lighter: #17233c;
  --md-default-fg-color: #e5ecff;
  --md-default-fg-color--light: #bac9ee;
  --md-default-fg-color--lighter: #8fa3d3;
  --md-primary-fg-color: #0f172a;
  --md-primary-fg-color--light: #1e293b;
  --md-primary-fg-color--dark: #020617;
  --md-accent-fg-color: #8b5cf6;
}

[data-md-color-scheme="default"] {
  --md-accent-fg-color: #6d28d9;
}

[data-md-color-scheme="slate"] .md-header {
  background: rgba(11, 16, 32, 0.72);
  backdrop-filter: blur(10px);
}

[data-md-color-scheme="slate"] .md-tabs {
  background: rgba(17, 26, 46, 0.82);
}

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

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

[data-md-color-scheme="slate"] .md-typeset code {
  color: #dbeafe;
  background: rgba(30, 41, 59, 0.75);
  border-radius: 0.4rem;
}

[data-md-color-scheme="slate"] .highlight pre {
  background: #0a1224;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 0.7rem;
}

[data-md-color-scheme="slate"] .md-typeset .admonition,
[data-md-color-scheme="slate"] .md-typeset details {
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: 0.7rem;
  background: rgba(17, 26, 46, 0.75);
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.25);
}

[data-md-color-scheme="slate"] .md-typeset .admonition-title,
[data-md-color-scheme="slate"] .md-typeset summary {
  background: rgba(139, 92, 246, 0.2);
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) {
  border-radius: 0.65rem;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.24);
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) th {
  background: rgba(139, 92, 246, 0.2);
}

[data-md-color-scheme="slate"] .md-typeset table:not([class]) tr:hover {
  background: rgba(148, 163, 184, 0.12);
}

[data-md-color-scheme="slate"] .md-typeset hr {
  border-bottom-color: rgba(148, 163, 184, 0.28);
}

[data-md-color-scheme="slate"] .md-top {
  background: rgba(15, 23, 42, 0.9);
}

[data-md-color-scheme="slate"] .md-typeset .md-button {
  border-radius: 0.6rem;
}

/* home page */

body:has(.home-layout) .md-sidebar--primary,
body:has(.home-layout) .md-sidebar--secondary {
  display: none;
}

body:has(.home-layout) .md-main__inner {
  max-width: 88rem;
  margin-inline: auto;
}

/* body:has(.home-layout) .md-source-file {
  display: none;
} */

.home-layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr) 16rem;
  gap: 1rem;
  align-items: start;
}

/* Keep page meta/comments aligned with center column on home */
body:has(.home-layout) .md-typeset > .home-layout ~ * {
  width: calc(100% - 34rem);
  margin-left: calc(16rem + 1rem);
  margin-right: calc(16rem + 1rem);
}

.home-profile,
.home-recent {
  position: sticky;
  top: 5.2rem;
  align-self: start;
  min-height: 22rem;
  max-height: calc(100vh - 6rem);
  overflow: auto;
  padding: 0.95rem;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 0.9rem;
  background: rgba(17, 26, 46, 0.72);
}

.home-recent {
  display: flex;
  flex-direction: column;
}

.home-avatar-wrap {
  position: relative;
  margin-bottom: 0.7rem;
}

.home-avatar {
  width: 100%;
  max-width: 14rem;
  aspect-ratio: 1 / 1;
  display: block;
  margin: 0 auto;
  border-radius: 999px;
  border: 3px solid rgba(226, 232, 240, 0.7);
  object-fit: cover;
}

.home-avatar-action {
  position: absolute;
  right: 0.6rem;
  bottom: 0.8rem;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: #1e293b;
  background: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.8);
  font-size: 0.95rem;
}

.home-profile h3,
.home-recent h3 {
  margin: 0.7rem 0 0.45rem;
  font-size: 1rem;
}

.home-profile h3:before,
.home-recent h3:before {
  content: none;
}

.home-profile-desc {
  margin: 0.7rem 0;
  font-size: 0.9rem;
  color: rgba(219, 234, 254, 0.86);
}

.home-profile-name {
  margin: 0.35rem 0 0.1rem !important;
  font-size: 2rem !important;
  line-height: 1.05;
}

.home-profile-handle {
  margin: 0;
  color: rgba(226, 232, 240, 0.68);
  font-size: 1.15rem;
}

.home-profile-edit,
.home-recent a,
.home-profile-meta a {
  text-decoration: none !important;
}

.home-profile-edit {
  display: block;
  margin-top: 0.8rem;
  padding: 0.5rem 0.7rem;
  text-align: center;
  border-radius: 0.55rem;
  color: #dbeafe !important;
  border: 1px solid rgba(148, 163, 184, 0.42);
  background: rgba(30, 41, 59, 0.7);
}

.home-profile-follow {
  margin: 0.9rem 0 0.6rem;
  color: rgba(219, 234, 254, 0.84);
}

.home-profile-meta {
  padding-top: 0.5rem;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
}

.home-profile-meta span,
.home-profile-meta a {
  display: block;
  margin: 0.34rem 0;
  color: rgba(226, 232, 240, 0.88);
}

.home-recent a {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 0.65rem;
  align-items: center;
  margin-bottom: 0.6rem;
  padding: 0.65rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  color: #e5ecff !important;
  background: rgba(30, 41, 59, 0.66);
  transition: border-color 0.2s ease, transform 0.2s ease;
  min-height: 6rem;
}

.home-recent-list {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.home-recent-list a {
  flex: 1;
}

.home-recent-thumb {
  width: 4rem;
  height: 4rem;
  border-radius: 0.6rem;
  object-fit: cover;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.home-recent a span {
  display: block;
  font-weight: 600;
}

.home-recent a small {
  display: block;
  margin-top: 0.3rem;
}

.home-recent a small {
  opacity: 0.7;
}

.home-recent a:hover {
  transform: translateX(2px);
  border-color: rgba(139, 92, 246, 0.5);
}

.home-center {
  min-width: 0;
}

.home-hero {
  position: relative;
  margin: 0.6rem 0 1.2rem;
  padding: 1.4rem 1.4rem 1.2rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 1rem;
  background: linear-gradient(120deg, rgba(124, 77, 255, 0.08), rgba(33, 150, 243, 0.08));
}

.home-badge {
  display: inline-block;
  margin: 0 0 0.55rem;
  padding: 0.22rem 0.56rem;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-accent-fg-color);
  background: color-mix(in srgb, var(--md-accent-fg-color) 14%, transparent);
}

.home-hero h1 {
  margin: 0.1rem 0 0.55rem;
  font-size: clamp(1.55rem, 2vw, 2.1rem);
  font-weight: 800;
}

.home-subtitle {
  margin: 0 0 1rem;
  max-width: 42rem;
  opacity: 0.9;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0 0.85rem;
}

.home-card {
  display: block;
  padding: 0.95rem 1rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.85rem;
  color: inherit !important;
  text-decoration: none !important;
  background: color-mix(in srgb, var(--md-default-bg-color) 85%, var(--md-default-fg-color) 15%);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.home-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--md-accent-fg-color) 35%, var(--md-default-fg-color--lightest));
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.home-card h3 {
  margin: 0;
  font-size: 1rem;
}

.home-card h3:before {
  content: none;
}

.home-card p {
  margin: 0.5rem 0 0;
  font-size: 0.84rem;
  opacity: 0.85;
}

.home-stats {
  margin: 0.4rem 0 0;
  padding: 0 1rem;
  border-radius: 0.75rem;
  border: 0 solid transparent;
  font-size: 0.84rem;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: all 0.2s ease, padding 0.2s ease, border-width 0.2s ease;
}

.home-stats.is-visible {
  opacity: 1;
  max-height: 16rem;
  padding: 0.85rem 1rem;
  border-width: 1px;
  border-color: var(--md-default-fg-color--lightest);
}

.home-stats p {
  margin: 0.2rem 0;
}

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

  body:has(.home-layout) .md-typeset > .home-layout ~ * {
    width: auto;
    margin-left: 0;
    margin-right: 0;
  }

  .home-profile,
  .home-recent {
    position: static;
    top: auto;
  }

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

@media (max-width: 640px) {
  .home-hero {
    padding: 1rem;
  }

  .home-grid {
    grid-template-columns: 1fr;
  }
}

/* v2 home style inspired by note.philfan.cn */

.home-hero--v2 {
  overflow: hidden;
  border: none;
  background:
    radial-gradient(circle at 8% 16%, rgba(59, 130, 246, 0.3), transparent 45%),
    radial-gradient(circle at 88% 12%, rgba(236, 72, 153, 0.25), transparent 40%),
    linear-gradient(135deg, rgba(15, 23, 42, 0.96), rgba(30, 41, 59, 0.94));
  color: #f8fafc;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
}

.home-hero--v2 .home-badge {
  color: #dbeafe;
  background: rgba(148, 163, 184, 0.22);
}

.home-hero--v2 .home-subtitle {
  color: rgba(248, 250, 252, 0.88);
}

.home-hero--v2 .md-button {
  border-color: rgba(226, 232, 240, 0.42);
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.18);
}

.home-hero--v2 .md-button--primary {
  border-color: transparent;
  color: #0f172a;
  background: #f8fafc;
}

.home-grid--v2 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.home-grid--v2 .home-card {
  border: 1px solid color-mix(in srgb, var(--md-accent-fg-color) 20%, var(--md-default-fg-color--lightest));
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--md-accent-fg-color) 10%, transparent), transparent 48%),
    color-mix(in srgb, var(--md-default-bg-color) 93%, var(--md-default-fg-color) 7%);
}

.home-grid--v2 .home-card h3 {
  font-weight: 700;
}

.type-cursor {
  display: inline-block;
  margin-left: 0.12rem;
  animation: cursor-blink 1s steps(2, start) infinite;
}

.enter {
  opacity: 0;
  transform: translateY(10px);
}

.home-ready .enter {
  animation: home-in 0.45s ease-out forwards;
  animation-delay: var(--d, 0s);
}

@keyframes home-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cursor-blink {
  50% {
    opacity: 0;
  }
}

@media (max-width: 1100px) {
  .home-grid--v2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .home-hero--v2 h1 {
    font-size: 1.45rem;
  }

  .home-grid--v2 {
    grid-template-columns: 1fr;
  }
}
