:root {
  color-scheme: dark;
  --bg: #0f0e12;
  --panel: rgba(26, 25, 31, 0.72);
  --panel-solid: #1a191f;
  --text: #e4e0df;
  --muted: #a9a19f;
  --amber: #f59e0b;
  --gold: #fcd34d;
  --brown: #b45309;
  --line: rgba(180, 83, 9, 0.28);
  --shadow: rgba(245, 158, 11, 0.16);
  --max-width: 1080px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 50% 0%, rgba(245, 158, 11, 0.14), transparent 34rem),
    linear-gradient(180deg, #141217 0%, var(--bg) 34rem);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.75;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

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

code {
  padding: 0.1rem 0.35rem;
  border: 1px solid rgba(252, 211, 77, 0.2);
  border-radius: 0.35rem;
  background: rgba(252, 211, 77, 0.08);
  color: #ffe7a3;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.site-shell {
  width: min(100% - 2rem, var(--max-width));
  margin: 0 auto;
}

.hero {
  min-height: min(34vh, 28rem);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 1.35rem 0 2rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
}

.brand,
.mail-link {
  display: inline-flex;
  align-items: center;
}

.brand {
  gap: 0.7rem;
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  width: 0.95rem;
  height: 0.95rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--amber));
  box-shadow: 0 0 1rem rgba(245, 158, 11, 0.86), 0 0 2.6rem rgba(252, 211, 77, 0.26);
}

.mail-link {
  min-height: 2.5rem;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.92rem;
  transition: border-color 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.mail-link:hover,
.mail-link:focus-visible {
  border-color: rgba(252, 211, 77, 0.5);
  color: var(--text);
  box-shadow: 0 0 1.4rem var(--shadow);
}

.hero-content {
  max-width: 760px;
  padding-top: 4rem;
}

.eyebrow {
  margin: 0 0 0.65rem;
  color: var(--gold);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.22;
  letter-spacing: 0;
}

h1 {
  max-width: 12em;
  font-size: clamp(2.45rem, 8vw, 5.9rem);
  font-weight: 800;
}

.intro {
  max-width: 670px;
  margin: 1.45rem 0 0;
  color: var(--muted);
  font-size: 1.08rem;
}

.notice,
.toc-section,
.post {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(18px);
}

.notice {
  padding: 1.1rem 1.25rem;
  border-radius: 0.5rem;
}

.notice p {
  margin: 0;
  color: var(--muted);
}

.toc-section {
  margin-top: 1rem;
  padding: 1.4rem;
  border-radius: 0.5rem;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.section-heading h2 {
  font-size: clamp(1.5rem, 4vw, 2.25rem);
}

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

.article-card {
  min-height: 11.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(180, 83, 9, 0.22);
  border-radius: 0.5rem;
  background: rgba(15, 14, 18, 0.54);
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease;
}

.article-card:hover,
.article-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(252, 211, 77, 0.55);
  background: rgba(26, 25, 31, 0.9);
  box-shadow: 0 0 2rem rgba(245, 158, 11, 0.18);
}

.card-index {
  color: var(--amber);
  font-size: 0.78rem;
  font-weight: 700;
}

.article-card strong {
  color: var(--text);
  font-size: 1.04rem;
  line-height: 1.42;
}

.article-card span:last-child {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.article-card::after {
  content: "阅读全文";
  align-self: flex-start;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
}

.articles {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.post {
  scroll-margin-top: 1rem;
  padding: clamp(1.25rem, 4vw, 2.1rem);
  border-radius: 0.5rem;
}

.post-meta {
  margin-bottom: 0.65rem;
  color: var(--amber);
  font-size: 0.8rem;
  font-weight: 700;
}

.post h2 {
  margin-bottom: 1rem;
  font-size: clamp(1.45rem, 4vw, 2.2rem);
}

.post p {
  max-width: 74ch;
  margin: 0.85rem 0 0;
  color: #cbc4c1;
}

.article-page .hero {
  min-height: auto;
  padding-bottom: 2rem;
}

.article-page .hero-content {
  padding-top: 3.2rem;
}

.article-page h1 {
  max-width: 13em;
  font-size: clamp(2.15rem, 7vw, 4.4rem);
}

.article-layout {
  display: grid;
  gap: 1rem;
}

.article-body {
  padding: clamp(1.35rem, 5vw, 3rem);
}

.article-body h2 {
  margin-top: 2.2rem;
  font-size: clamp(1.35rem, 4vw, 1.9rem);
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body p,
.article-body li {
  color: #cbc4c1;
}

.article-body p {
  max-width: 76ch;
  margin: 1rem 0 0;
}

.article-body ul {
  max-width: 76ch;
  margin: 0.9rem 0 0;
  padding-left: 1.2rem;
}

.article-body li + li {
  margin-top: 0.45rem;
}

.article-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.text-link {
  display: inline-flex;
  min-height: 2.55rem;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--gold);
  font-weight: 700;
  transition: border-color 180ms ease, box-shadow 180ms ease, color 180ms ease;
}

.text-link:hover,
.text-link:focus-visible {
  border-color: rgba(252, 211, 77, 0.55);
  color: var(--text);
  box-shadow: 0 0 1.35rem var(--shadow);
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 2.2rem 0 2.8rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  border-bottom: 1px solid rgba(252, 211, 77, 0.24);
  transition: color 180ms ease, border-color 180ms ease;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--gold);
  border-color: rgba(252, 211, 77, 0.7);
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(252, 211, 77, 0.34);
  border-radius: 50%;
  background: rgba(26, 25, 31, 0.82);
  color: var(--gold);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.6rem);
  transition: opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease;
  backdrop-filter: blur(12px);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  box-shadow: 0 0 1.6rem rgba(245, 158, 11, 0.24);
}

.fade-in {
  opacity: 0;
  transform: translateY(1rem);
  transition: opacity 640ms ease, transform 640ms ease;
}

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

@media (max-width: 860px) {
  .hero {
    min-height: 36vh;
    padding-bottom: 2rem;
  }

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

@media (max-width: 640px) {
  .site-shell {
    width: min(100% - 1.1rem, var(--max-width));
  }

  .topbar,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .mail-link {
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .hero-content {
    padding-top: 2.4rem;
  }

  h1 {
    font-size: clamp(2.25rem, 14vw, 3.8rem);
  }

  .intro {
    font-size: 1rem;
  }

  .notice,
  .toc-section,
  .post {
    backdrop-filter: none;
  }

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

  .article-card {
    min-height: 9.8rem;
  }
}

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