/* 咕咕的花圃卡片主题：只加载本机字体，不依赖外站资源。 */
:root {
  color-scheme: light dark;
  --bg: light-dark(#f7f5f2, #171513);
  --text: light-dark(#1c1917, #f5f2ef);
  --muted: light-dark(#6b625c, #a8a29e);
  --line: light-dark(#e7e2dc, #3a342f);
  --link: light-dark(#9a3412, #fdba74);
  --code: light-dark(#f0eeeb, #292524);
  --card: light-dark(#fffefc, #221e1b);
  --shadow: light-dark(rgb(28 25 23 / 0.07), rgb(0 0 0 / 0.35));
  --shadow-hover: light-dark(rgb(28 25 23 / 0.18), rgb(0 0 0 / 0.65));
}
:root[data-scheme='dark'] { color-scheme: dark; }
:root[data-scheme='light'] { color-scheme: light; }
:root:has(#myriad-nav[data-scheme='dark']) { color-scheme: dark; }
:root:has(#myriad-nav[data-scheme='light']) { color-scheme: light; }

* { box-sizing: border-box; }
html { font-size: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--link) 7%, transparent), transparent 42rem),
    var(--bg);
  color: var(--text);
  font-family: "Iowan Old Style", Palatino, "Palatino Linotype", "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  line-height: 1.75;
  word-break: break-word;
}

.site-header, main, .site-footer {
  max-width: 68rem;
  margin: 0 auto;
  padding: 1.25rem;
}
@media (width >= 1078px), (width >= 768px) and (not (pointer: coarse)) {
  .site-header, main, .site-footer {
    margin-left: max(6.5rem, calc((100% - 68rem) / 2));
    margin-right: auto;
  }
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
  padding-top: 1.6rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.site-title {
  color: inherit;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
}
nav a { margin-left: 1rem; color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--link); }
a { color: var(--link); }
img, video, svg { max-width: 100%; height: auto; }

/* ---------- 首页：封面卡片 ---------- */
.blog-hero { margin: 2.2rem 0 1.7rem; }
.blog-hero h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.7rem, 3.2vw, 2.45rem);
  line-height: 1.25;
  letter-spacing: 0.01em;
}
.blog-hero p, .hero-body { margin: 0; color: var(--muted); font-size: 0.98rem; }

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr));
  gap: 1.35rem;
}
.post-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  box-shadow: 0 1px 2px var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.post-card:hover, .post-card:focus-visible {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--link) 42%, var(--line));
  box-shadow: 0 14px 30px -16px var(--shadow-hover);
}
.post-card:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }

.card-cover {
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--code);
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.45s ease;
}
.post-card:hover .card-cover img { transform: scale(1.045); }
.card-cover-empty {
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--link) 18%, var(--card)), var(--code));
}
.card-cover-empty span {
  font-size: 3rem;
  font-weight: 700;
  color: color-mix(in srgb, var(--link) 70%, var(--text));
  opacity: 0.8;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.95rem 1.05rem 1.1rem;
  flex: 1;
}
.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-height: 1.4rem;
}
.card-cat {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--link) 13%, var(--card));
  color: color-mix(in srgb, var(--link) 80%, var(--text));
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.5;
}
.card-date {
  color: var(--muted);
  font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
}
.card-title {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.45;
  font-weight: 700;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.card-excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
}
.card-more {
  margin-top: auto;
  padding-top: 0.25rem;
  color: var(--link);
  font-size: 0.82rem;
  font-weight: 600;
}

/* ---------- 分页 ---------- */
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.45rem;
  margin: 2.4rem 0 1rem;
}
.page-link {
  min-width: 2.2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.5;
}
.page-link:hover { border-color: var(--link); color: var(--link); }
.page-link.active {
  background: var(--link);
  border-color: var(--link);
  color: light-dark(#fff, #1c1917);
  font-weight: 700;
}

/* ---------- 文章页 ---------- */
.myriad-post { max-width: 46rem; margin: 0 auto; }
.back-link {
  display: inline-block;
  margin: 0.4rem 0 1.2rem;
  color: var(--muted);
  font-size: 0.86rem;
  text-decoration: none;
}
.back-link:hover { color: var(--link); }
.article-header h1 {
  margin: 0.55rem 0 0.7rem;
  font-size: clamp(1.65rem, 3.2vw, 2.25rem);
  line-height: 1.3;
}
.meta { color: var(--muted); font-size: 0.9rem; }
.meta .authors { margin-left: 0.6rem; }
.cover { margin: 1.4rem 0 1.8rem; }
.cover img { display: block; width: 100%; border-radius: 12px; }

.content { font-size: 1.02rem; }
.content h2, .content h3 { margin: 2rem 0 0.7rem; line-height: 1.35; }
.content p { margin: 0 0 1.05rem; }
.content img { display: block; max-width: 100%; margin: 1.2rem auto; border-radius: 10px; }
.content figure { margin: 1.5rem 0; }
.content figcaption { color: var(--muted); font-size: 0.85rem; text-align: center; }
.content a { text-underline-offset: 0.2em; }
.content blockquote {
  margin: 1.2em 0;
  padding: 0.2rem 0 0.2rem 1rem;
  border-left: 3px solid color-mix(in srgb, var(--link) 45%, var(--line));
  color: var(--muted);
}
.content pre {
  overflow: auto;
  padding: 0.9rem 1rem;
  background: var(--code);
  border-radius: 10px;
  line-height: 1.55;
  font-size: 0.9rem;
}
.content :not(pre) > code {
  padding: 0.1em 0.35em;
  background: var(--code);
  border-radius: 5px;
  font-size: 0.9em;
}
pre, code {
  font-family: ui-monospace, "SFMono-Regular", "Source Han Mono SC", "Noto Sans Mono CJK SC", monospace;
}
.content table { border-collapse: collapse; width: 100%; margin: 1.2rem 0; }
.content th, .content td {
  border-bottom: 1px solid var(--line);
  padding: 0.4rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.content hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }
.article-footer { margin: 2.4rem 0 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.site-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 600px) {
  .site-header, main, .site-footer { padding: 0.9rem; }
  .blog-hero { margin-top: 1.4rem; }
  .post-grid { gap: 1rem; }
  .card-title { font-size: 1.02rem; }
}

@media (prefers-reduced-motion: reduce) {
  .post-card, .card-cover img { transition: none; }
  .post-card:hover, .post-card:focus-visible { transform: none; }
  .post-card:hover .card-cover img { transform: none; }
}
