/* Anheyu-inspired single-column blog — large type */

:root,
html[data-theme="light"] {
  --bg: #f7f9fe;
  --card: #ffffff;
  --border: #e3e8f7;
  --fg: #363636;
  --muted: rgba(60, 60, 67, 0.8);
  --theme: #425aef;
  --theme-deep: #1856fb;
  --theme-op: #4259ef23;
  --theme-op-deep: #4259efdd;
  --secondbg: #f7f7f9;
  --blockquote-bg: #fafcff;
  --ahoverbg: #f7f7fa;
  --card-btn: #edf0f7;
  --shadow-nav: 0 5px 12px -5px rgba(102, 68, 68, 0.05);
  --shadow-border: 0 8px 16px -4px #2c2d300c;
  --shadow-hover: 0 8px 16px -4px #2c2d3018;
  --radius: 12px;
  --header-bg: rgba(247, 249, 254, 0.78);
  --lightbox-bg: rgba(0, 0, 0, 0.72);
  --selection: #2128bd;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --col: min(48rem, calc(100% - 2rem));
  --fs-body: 21px;
  --fs-sm: 15px;
  --fs-meta: 14px;
  --lh: 1.8;
  --header-h: 3.75rem;
  color-scheme: light;
}

html[data-theme="dark"] {
  --bg: #18171d;
  --card: #1d1e22;
  --border: #42444a;
  --fg: #f7f7fa;
  --muted: #a1a2b8;
  --theme: #f2b94b;
  --theme-deep: #ffc93e;
  --theme-op: #f2b94b23;
  --theme-op-deep: #f2b94bdd;
  --secondbg: #21232a;
  --blockquote-bg: #000;
  --ahoverbg: #30343f;
  --card-btn: #30343f;
  --shadow-nav: 0 5px 20px 0 rgba(28, 28, 28, 0.4);
  --shadow-border: 0 8px 16px -4px rgba(0, 0, 0, 0.35);
  --shadow-hover: 0 8px 20px -4px rgba(0, 0, 0, 0.45);
  --header-bg: rgba(24, 23, 29, 0.82);
  --lightbox-bg: rgba(0, 0, 0, 0.85);
  --selection: #0a84ff;
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 0.75rem);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

::selection {
  background: var(--selection);
  color: #f7f7f7;
}

a {
  color: var(--theme);
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease,
    box-shadow 0.2s ease, opacity 0.2s ease;
}

a:hover {
  color: var(--theme-deep);
}

:focus-visible {
  outline: 2px solid var(--theme);
  outline-offset: 3px;
}

img {
  max-width: 100%;
  height: auto;
}

.muted {
  color: var(--muted);
}

.skip-link {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 1000;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius);
  background: var(--theme);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
}

.skip-link:focus {
  top: 0.75rem;
  color: #fff;
}

html[data-theme="dark"] .skip-link:focus {
  color: #18171d;
}

/* Reading progress */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  height: 3px;
  width: var(--progress, 0%);
  background: linear-gradient(90deg, var(--theme), var(--theme-deep));
  pointer-events: none;
  transition: width 0.08s linear;
}

.read-progress[hidden] {
  display: none !important;
}

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: saturate(1.2) blur(12px);
  -webkit-backdrop-filter: saturate(1.2) blur(12px);
  background: var(--header-bg);
  border-bottom: 1px solid transparent;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.site-header.is-scrolled {
  border-bottom-color: var(--border);
  box-shadow: var(--shadow-nav);
}

.site-header-inner {
  width: var(--col);
  margin: 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  padding: 0.35rem 0;
}

.site-brand {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 10em;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--fg);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-brand:hover {
  color: var(--theme);
}

.site-nav {
  flex: 1 1 auto;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.1rem;
  min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.site-nav::-webkit-scrollbar {
  display: none;
}

.site-nav a {
  position: relative;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 0.4rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
}

.site-nav a:hover {
  color: var(--theme);
  background: var(--theme-op);
}

.site-nav a.is-active {
  color: var(--theme);
  background: var(--theme-op);
  font-weight: 650;
}

.site-header-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-left: 0;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  line-height: 1;
}

.icon-btn:hover {
  background: var(--ahoverbg);
  color: var(--theme);
}

html[data-theme="light"] .icon-moon {
  display: none;
}
html[data-theme="dark"] .icon-sun {
  display: none;
}

.menu-toggle {
  display: none;
}

.menu-bars {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 1.1rem;
}

.menu-bars span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-header.is-menu-open .menu-bars span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.site-header.is-menu-open .menu-bars span:nth-child(2) {
  opacity: 0;
}
.site-header.is-menu-open .menu-bars span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(0, 0, 0, 0.28);
}

.nav-backdrop[hidden] {
  display: none !important;
}

/* ——— Main column ——— */
.site-main {
  flex: 1 0 auto;
  width: var(--col);
  margin: 0 auto;
  padding: 1.75rem 0 3.5rem;
}

#post-list {
  scroll-margin-top: calc(var(--header-h) + 0.75rem);
}

/* ——— Breadcrumb ——— */
.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin: 0 0 1rem;
  font-size: var(--fs-meta);
  color: var(--muted);
}

.breadcrumb a {
  color: var(--muted);
}

.breadcrumb a:hover {
  color: var(--theme);
}

.crumb-sep {
  opacity: 0.5;
}

.seo-article > .breadcrumb {
  margin-bottom: 0.85rem;
}

/* ——— Hero (home) ——— */
.blog-hero {
  margin-bottom: 1.75rem;
  padding: 2.5rem 1.75rem 2.15rem;
  background:
    radial-gradient(120% 80% at 50% -20%, var(--theme-op), transparent 55%),
    var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-border);
  text-align: center;
}

.blog-hero .hero-brand {
  margin: 0 0 0.65rem;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
  color: var(--fg);
}

.blog-hero .hero-tagline {
  margin: 0 auto 1.35rem;
  max-width: 32rem;
  font-size: 1.12rem;
  color: var(--muted);
  line-height: 1.55;
}

.blog-hero .hero-cta {
  display: inline-block;
  padding: 0.7rem 1.5rem;
  border-radius: 50px;
  background: var(--theme);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
  box-shadow: 0 8px 12px -3px var(--theme-op);
}

.blog-hero .hero-cta:hover {
  background: var(--theme-deep);
  color: #fff;
  transform: translateY(-1px);
}

html[data-theme="dark"] .blog-hero .hero-cta,
html[data-theme="dark"] .blog-hero .hero-cta:hover {
  color: #18171d;
}

/* ——— Collection ——— */
.seo-collection,
.seo-notfound {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.seo-collection > h1,
.page-heading {
  margin: 0 0 0.25rem;
  font-size: clamp(1.75rem, 3.5vw, 2.4rem);
  font-weight: 750;
  line-height: 1.25;
}

.seo-collection > .page-intro,
.seo-collection > [itemprop="description"] {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  color: var(--muted);
}

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.post-card {
  position: relative;
  display: block;
  padding: 1.4rem 1.55rem 1.45rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-border);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.post-card-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}

.post-card .cat-pill {
  position: relative;
  z-index: 2;
}

.post-card:hover,
.post-card:focus-within {
  border-color: var(--theme);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.post-card .post-title {
  margin: 0 0 0.45rem;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1.35;
}

.post-card .post-title a {
  color: var(--fg);
  position: relative;
  z-index: 0;
}

.post-card:hover .post-title a,
.post-card:focus-within .post-title a {
  color: var(--theme);
}

.post-card .post-summary {
  margin: 0 0 0.7rem;
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.85rem;
  font-size: var(--fs-meta);
  color: var(--muted);
}

.post-meta a {
  color: var(--theme);
}

.post-meta .cat-pill {
  display: inline-block;
  padding: 0.15rem 0.65rem;
  border-radius: 50px;
  background: var(--theme-op);
  color: var(--theme);
  font-weight: 600;
}

.post-meta .cat-pill:hover {
  background: var(--theme);
  color: #fff;
}

html[data-theme="dark"] .post-meta .cat-pill:hover {
  color: #18171d;
}

.empty-list {
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  list-style: none;
}

/* ——— Pagination ——— */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 0.75rem;
}

.pager a,
.pager span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.55rem;
  height: 2.55rem;
  padding: 0 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--fg);
  font-size: var(--fs-sm);
  font-weight: 600;
}

.pager a:hover {
  border-color: var(--theme);
  color: var(--theme);
  background: var(--theme-op);
}

.pager .is-current {
  background: var(--theme);
  border-color: var(--theme);
  color: #fff;
}

html[data-theme="dark"] .pager .is-current {
  color: #18171d;
}

.pager .is-disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* ——— Article ——— */
.seo-article {
  padding: 2rem 1.75rem 2.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-border);
}

.seo-article > h1 {
  margin: 0 0 0.75rem;
  font-size: clamp(2rem, 4.5vw, 2.85rem);
  font-weight: 800;
  line-height: 1.28;
  letter-spacing: 0.01em;
}

.seo-article > .post-meta {
  margin-bottom: 0.95rem;
}

.seo-article > [itemprop="description"],
.seo-article > .article-summary {
  margin: 0 0 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 1.1rem;
  color: var(--muted);
}

.article-body {
  font-size: var(--fs-body);
  line-height: var(--lh);
  word-break: break-word;
}

.article-body > :first-child {
  margin-top: 0;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  margin: 1.85rem 0 0.75rem;
  line-height: 1.3;
  font-weight: 750;
  color: var(--fg);
  scroll-margin-top: calc(var(--header-h) + 0.75rem);
}

.article-body h2 {
  font-size: 1.55rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
}
.article-body h3 {
  font-size: 1.3rem;
}
.article-body h4 {
  font-size: 1.15rem;
}

.article-body p,
.article-body li {
  margin: 0 0 1em;
}

.article-body ul,
.article-body ol {
  padding-left: 1.35em;
  margin: 0 0 1em;
}

.article-body li + li {
  margin-top: 0.35em;
}

.article-body a {
  text-decoration: underline;
  text-decoration-color: var(--theme-op-deep);
  text-underline-offset: 0.18em;
}

.article-body blockquote {
  margin: 0 0 1.25rem;
  padding: 0.85rem 1.15rem;
  border-left: 3px solid var(--theme);
  background: var(--blockquote-bg);
  color: var(--muted);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.article-body blockquote > :last-child {
  margin-bottom: 0;
}

.article-body pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  background: var(--secondbg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9em;
  line-height: 1.55;
  -webkit-overflow-scrolling: touch;
}

.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.article-body :not(pre) > code {
  padding: 0.12em 0.42em;
  border-radius: 5px;
  background: var(--theme-op);
  color: var(--theme);
}

.article-body .seo-img {
  margin: 1.5rem 0;
  text-align: center;
}

.article-body .seo-img img {
  border-radius: var(--radius);
  cursor: zoom-in;
  box-shadow: var(--shadow-border);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.article-body .seo-img img:hover {
  transform: scale(1.01);
  box-shadow: var(--shadow-hover);
}

.article-body hr {
  border: none;
  border-top: 2px dashed var(--theme-op);
  margin: 2rem 0;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.25rem;
  font-size: 0.95em;
  display: block;
  overflow-x: auto;
}

.article-body th,
.article-body td {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  text-align: left;
}

.article-body th {
  background: var(--secondbg);
  font-weight: 650;
}

.article-body tr:nth-child(even) td {
  background: var(--theme-op);
}

.article-nav {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.article-nav a {
  display: block;
  padding: 0.95rem 1.1rem;
  background: var(--secondbg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--fg);
  font-size: 1.05rem;
  font-weight: 600;
}

.article-nav a:hover {
  border-color: var(--theme);
  color: var(--theme);
  background: var(--theme-op);
}

.article-nav .nav-label {
  display: block;
  font-size: var(--fs-meta);
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.article-back {
  margin: 1.5rem 0 0;
  font-size: var(--fs-sm);
}

.article-back a {
  color: var(--muted);
  font-weight: 500;
}

.article-back a:hover {
  color: var(--theme);
}

.seo-chrome {
  margin: 1.25rem 0;
}

.article-ad,
.article-footer-block {
  padding: 1rem 1.15rem;
  background: var(--secondbg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
}

.article-footer-heading {
  font-weight: 700;
  margin-bottom: 0.5rem;
}

/* ——— 404 ——— */
.seo-notfound {
  padding: 2.75rem 1.75rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-border);
  text-align: center;
}

.seo-notfound h1 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
}

.seo-notfound .article-link,
.seo-notfound a {
  display: inline-block;
  margin-top: 0.75rem;
  padding: 0.55rem 1.2rem;
  border-radius: 50px;
  background: var(--theme);
  color: #fff;
  font-size: var(--fs-sm);
  font-weight: 600;
}

html[data-theme="dark"] .seo-notfound a {
  color: #18171d;
}

/* ——— Footer ——— */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.75rem 0 2.25rem;
  background: transparent;
}

.site-footer-inner {
  width: var(--col);
  margin: 0 auto;
  text-align: center;
}

.footer-brand {
  margin: 0 0 0.35rem;
  font-weight: 700;
  font-size: 1.05rem;
}

.footer-meta {
  margin: 0;
  font-size: var(--fs-meta);
}

.footer-meta a {
  color: var(--muted);
}

.footer-meta a:hover {
  color: var(--theme);
}

.footer-meta .dot {
  margin: 0 0.4rem;
}

/* ——— Back to top ——— */
.back-top {
  position: fixed;
  right: max(1rem, calc((100vw - 48rem) / 2 - 3.25rem));
  bottom: 1.75rem;
  z-index: 45;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--card);
  color: var(--fg);
  box-shadow: var(--shadow-border);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease,
    opacity 0.2s ease;
}

.back-top:hover {
  border-color: var(--theme);
  color: var(--theme);
  transform: translateY(-2px);
}

.back-top[hidden] {
  display: none !important;
}

/* ——— Lightbox ——— */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--lightbox-bg);
  padding: 1.5rem;
  animation: fade-in 0.18s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.img-lightbox[hidden] {
  display: none !important;
}

.img-lightbox img {
  max-width: min(96vw, 1100px);
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.img-lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: var(--card);
  color: var(--fg);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

/* ——— Mobile nav ——— */
@media (max-width: 720px) {
  :root {
    --fs-body: 19px;
    --header-h: 3.4rem;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    z-index: 41;
    flex-direction: column;
    align-items: stretch;
    gap: 0.15rem;
    padding: 0.65rem 1rem 0.9rem;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-border);
  }

  .site-header.is-menu-open .site-nav {
    display: flex;
  }

  .site-nav a {
    padding: 0.8rem 0.65rem;
    border-radius: var(--radius);
    font-size: 1.05rem;
  }

  .site-header-inner {
    position: relative;
    flex-wrap: nowrap;
  }

  .site-brand {
    font-size: 1.2rem;
  }

  .blog-hero {
    padding: 1.85rem 1.25rem;
  }

  .seo-article,
  .post-card {
    padding-left: 1.15rem;
    padding-right: 1.15rem;
  }

  .back-top {
    right: 1rem;
    bottom: 1.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
