/* doge 主题 —— much 样式, such 滑稽 */

:root {
  --bg: #fff6e6;
  --dot: #f1dcb8;
  --card: #fffdf8;
  --ink: #3a2a1b;
  --muted: #8b7259;
  --brand: #ee9a35;
  --brand-soft: #ffe2b3;
  --brand-ink: #b8620c;
  --line: #3a2a1b;
  --shadow: #3a2a1b;
  --pink: #ff7d9c;
  --code-bg: #2a2119;
  --code-ink: #f4e7d4;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --fun: "Comic Sans MS", "Chalkboard SE", "Comic Neue", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}
:root[data-theme="dark"] {
  --bg: #1b1510;
  --dot: #2c2219;
  --card: #251d16;
  --ink: #f3e6d3;
  --muted: #b39b80;
  --brand: #f5a94a;
  --brand-soft: #4a3520;
  --brand-ink: #ffc073;
  --line: #5c4630;
  --shadow: #000;
  --code-bg: #120e0a;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1510;
    --dot: #2c2219;
    --card: #251d16;
    --ink: #f3e6d3;
    --muted: #b39b80;
    --brand: #f5a94a;
    --brand-soft: #4a3520;
    --brand-ink: #ffc073;
    --line: #5c4630;
    --shadow: #000;
    --code-bg: #120e0a;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font: 16px/1.8 var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-ink); text-decoration: none; }
a:hover { text-decoration: underline wavy var(--brand); text-underline-offset: 4px; }
img { max-width: 100%; height: auto; }
::selection { background: var(--brand); color: #fff; }

.wrap { width: 100%; max-width: 820px; margin: 0 auto; padding: 0 18px; }
.main { padding-block: 28px 56px; min-height: 60vh; position: relative; z-index: 1; }

/* 卡片：粗描边 + 错位阴影 */
.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--shadow);
}

.btn {
  display: inline-block;
  padding: 6px 18px;
  font-weight: 700;
  color: var(--ink);
  background: var(--brand);
  border: 2px solid var(--line);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.btn:hover { text-decoration: none; transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--shadow); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--shadow); }

/* ---------- 顶栏 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 2px dashed var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { padding: 0; border: 0; background: none; cursor: pointer; line-height: 0; }
.brand-logo img { transition: transform .3s; }
.brand-logo:hover img { transform: rotate(-12deg) scale(1.08); }
.brand-logo.spin img { animation: spin .7s cubic-bezier(.3, 1.6, .5, 1); }
.brand-text { display: flex; flex-direction: column; line-height: 1.25; color: var(--ink); min-width: 0; }
.brand-text:hover { text-decoration: none; }
.brand-title { font-family: var(--fun); font-size: 22px; font-weight: 700; letter-spacing: .5px; }
.brand-sub { font-size: 12px; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.nav a {
  padding: 2px 12px;
  border-radius: 999px;
  border: 2px solid transparent;
  color: var(--ink);
  font-weight: 600;
}
.nav a:hover { text-decoration: none; border-color: var(--line); background: var(--brand-soft); }
.nav a.active { border-color: var(--line); background: var(--brand); }
.theme-toggle {
  width: 34px; height: 34px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}
.theme-toggle::before { content: "☾"; }
:root[data-theme="dark"] .theme-toggle::before { content: "☀"; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .theme-toggle::before { content: "☀"; } }

/* ---------- 首页 ---------- */
.hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 28px;
  padding: 22px 24px;
  background: var(--brand-soft);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--shadow);
}
.hero h1 { margin: 0; font-family: var(--fun); font-size: 26px; line-height: 1.3; }
.hero p { margin: 4px 0 0; color: var(--muted); }
.hero-doge { flex: none; width: 88px; animation: wobble 3s ease-in-out infinite; }

.post-list { display: grid; gap: 24px; }
.post-card { padding: 20px 24px; transition: transform .2s, box-shadow .2s; }
.post-card:nth-child(odd):hover { transform: rotate(-.6deg) translate(-2px, -2px); box-shadow: 8px 8px 0 var(--shadow); }
.post-card:nth-child(even):hover { transform: rotate(.6deg) translate(-2px, -2px); box-shadow: 8px 8px 0 var(--shadow); }
.post-card-title { margin: 0 0 4px; font-size: 22px; line-height: 1.4; }
.post-card-title a { color: var(--ink); }
.excerpt { margin: 10px 0 12px; color: var(--ink); opacity: .85; }
.post-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.more { font-weight: 700; margin-left: auto; }

.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; color: var(--muted); }
.meta-cat { padding: 0 8px; border-radius: 6px; background: var(--brand-soft); color: var(--brand-ink); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 13px;
  padding: 0 10px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
}
.tag:hover { text-decoration: none; background: var(--brand); }

.empty { padding: 28px; text-align: center; color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 32px; }
.pager-num { font-family: var(--fun); color: var(--muted); }

/* ---------- 文章 ---------- */
.article { padding: 28px 32px 24px; }
.article-head { margin-bottom: 20px; padding-bottom: 14px; border-bottom: 2px dashed var(--line); }
.article-head h1 { margin: 0 0 6px; font-size: 30px; line-height: 1.35; }

.toc {
  margin: 0 0 20px;
  padding: 8px 16px;
  border: 2px solid var(--line);
  border-radius: 12px;
  background: var(--brand-soft);
  font-size: 14px;
}
.toc summary { cursor: pointer; font-weight: 700; }
.toc ol { margin: 6px 0; padding-left: 1.2em; list-style: none; }
.toc ol ol { padding-left: 1.2em; }
.toc a { color: var(--ink); }

.content { overflow-wrap: break-word; }
.content h2, .content h3, .content h4 { line-height: 1.4; margin: 1.8em 0 .6em; scroll-margin-top: 80px; }
.content h2 { font-size: 23px; padding-left: 12px; border-left: 6px solid var(--brand); border-radius: 2px; }
.content h3 { font-size: 19px; }
.content h3::before { content: "# "; color: var(--brand); }
.content p, .content ul, .content ol { margin: .8em 0; }
.content blockquote {
  margin: 1em 0;
  padding: 8px 16px;
  border-left: 5px solid var(--brand);
  background: var(--brand-soft);
  border-radius: 0 12px 12px 0;
}
.content blockquote p { margin: .3em 0; }
.content img { display: block; margin: 1em auto; border-radius: 12px; border: 2px solid var(--line); }
.content hr { border: 0; text-align: center; margin: 2em 0; }
.content hr::after { content: "汪 · 汪 · 汪"; color: var(--muted); letter-spacing: 4px; }
.content > table { display: block; overflow-x: auto; border-collapse: collapse; margin: 1em 0; }
.content th, .content td { padding: 6px 12px; border: 1.5px solid var(--line); }
.content th { background: var(--brand-soft); }
.content kbd { padding: 1px 6px; border: 1.5px solid var(--line); border-bottom-width: 3px; border-radius: 6px; font-family: var(--mono); font-size: .85em; }
.content :not(pre) > code {
  padding: 1px 6px;
  font-family: var(--mono);
  font-size: .88em;
  background: var(--brand-soft);
  color: var(--brand-ink);
  border-radius: 6px;
}

/* 代码块（highlight.js，无前缀类名） */
figure.highlight {
  position: relative;
  margin: 1.2em 0;
  padding: 0;
  overflow: hidden;
  background: var(--code-bg);
  color: var(--code-ink);
  border: 2px solid var(--line);
  border-radius: 14px;
  box-shadow: 4px 4px 0 var(--shadow);
  font: 14px/1.6 var(--mono);
}
figure.highlight::before {
  content: "";
  display: block;
  height: 28px;
  background:
    radial-gradient(circle at 16px 14px, #ff6159 5px, transparent 5.5px),
    radial-gradient(circle at 34px 14px, #ffbd2e 5px, transparent 5.5px),
    radial-gradient(circle at 52px 14px, #28c940 5px, transparent 5.5px);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
figure.highlight figcaption { position: absolute; top: 4px; left: 70px; font-size: 12px; color: #a8957c; }
figure.highlight figcaption a { color: inherit; }
figure.highlight table { width: 100%; border-collapse: collapse; margin: 0; display: block; overflow-x: auto; }
figure.highlight td { padding: 0; border: 0; vertical-align: top; }
figure.highlight pre { margin: 0; padding: 12px 16px; font: inherit; }
figure.highlight .gutter pre { padding-right: 10px; color: #6f604f; text-align: right; user-select: none; }
figure.highlight .code { width: 100%; }
figure.highlight .line { display: inline-block; min-height: 1.6em; }
.copy-btn {
  position: absolute;
  top: 3px;
  right: 8px;
  padding: 0 10px;
  font: 12px/22px var(--font);
  color: #e9d8c0;
  background: rgba(255, 255, 255, .08);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.copy-btn:hover { background: var(--brand); color: #2a2119; }
.highlight .comment, .highlight .quote { color: #8c7a66; font-style: italic; }
.highlight .keyword, .highlight .selector-tag, .highlight .literal, .highlight .doctag { color: #ff8fab; }
.highlight .string, .highlight .regexp, .highlight .addition, .highlight .attribute { color: #b8e07a; }
.highlight .number, .highlight .symbol, .highlight .bullet, .highlight .variable, .highlight .template-variable { color: #ffb86b; }
.highlight .title, .highlight .section, .highlight .name, .highlight .selector-id, .highlight .selector-class { color: #7cc8ff; }
.highlight .built_in, .highlight .type, .highlight .class .title { color: #ffd76b; }
.highlight .attr, .highlight .params, .highlight .meta { color: #d9b8ff; }
.highlight .tag { color: #a8957c; }
.highlight .deletion { color: #ff6b6b; }
.highlight .emphasis { font-style: italic; }
.highlight .strong { font-weight: 700; }

.article-foot { margin-top: 32px; padding-top: 18px; border-top: 2px dashed var(--line); display: grid; gap: 16px; }
.the-end { display: flex; align-items: center; justify-content: center; gap: 22px; color: var(--muted); }
.stamp {
  display: inline-block;
  padding: 2px 12px;
  font-family: var(--fun);
  font-weight: 700;
  color: #e5484d;
  border: 3px double #e5484d;
  border-radius: 8px;
  transform: rotate(-10deg);
  opacity: .85;
  user-select: none;
}

.post-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 28px; }
.post-nav a { display: flex; flex-direction: column; padding: 12px 18px; color: var(--ink); font-weight: 600; transition: transform .15s; }
.post-nav a:hover { text-decoration: none; transform: translate(-2px, -2px); }
.post-nav small { color: var(--muted); font-weight: 400; }
.post-nav .next { text-align: right; grid-column: 2; }

/* ---------- 归档 ---------- */
.archive { padding: 26px 32px; }
.page-title { margin: 0; font-family: var(--fun); font-size: 28px; }
.page-desc { margin: 2px 0 8px; color: var(--muted); }
.year { margin: 22px 0 8px; font-family: var(--fun); font-size: 22px; color: var(--brand-ink); }
.timeline { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 3px dotted var(--brand); }
.timeline li { position: relative; display: flex; gap: 14px; padding: 6px 0; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 15px;
  width: 13px; height: 13px;
  background: var(--card);
  border: 2.5px solid var(--brand);
  border-radius: 50%;
}
.timeline li:hover::before { background: var(--brand); }
.timeline time { flex: none; font-family: var(--mono); font-size: 14px; color: var(--muted); padding-top: 2px; }
.timeline a { color: var(--ink); }

/* ---------- 404 ---------- */
.not-found { text-align: center; padding-block: 30px; }
.lost-doge { width: 150px; animation: lost 2.4s ease-in-out infinite; }
.not-found h1 { margin: 10px 0 0; font: 700 72px/1 var(--fun); color: var(--brand); text-shadow: 4px 4px 0 var(--shadow); }
.not-found .big { font-size: 22px; font-weight: 700; margin: 12px 0 4px; }
.not-found .content { color: var(--muted); margin-bottom: 18px; }

/* ---------- 页脚 ---------- */
.site-footer { position: relative; z-index: 1; padding-block: 24px 36px; border-top: 2px dashed var(--line); text-align: center; color: var(--muted); font-size: 14px; }
.site-footer p { margin: 4px 0; }
.footer-quote { font-family: var(--fun); font-size: 16px; color: var(--brand-ink); }
.footer-small { font-size: 12px; }

/* ---------- 小玩意 ---------- */
.doge-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.doge-word {
  position: absolute;
  font: 700 22px var(--fun);
  white-space: nowrap;
  opacity: .5;
  animation: float 6s ease-in-out infinite;
}

.to-top {
  position: fixed;
  right: 18px;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 4px 4px 2px;
  border: 2px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: 3px 3px 0 var(--shadow);
  color: var(--ink);
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover img { animation: wobble .6s; }
.to-top.fly { animation: fly .6s ease-in forwards; }

.toast {
  position: fixed;
  left: 50%;
  top: 80px;
  z-index: 30;
  padding: 6px 18px;
  font: 700 16px var(--fun);
  background: var(--brand);
  color: #2a1a0b;
  border: 2px solid var(--line);
  border-radius: 999px;
  box-shadow: 3px 3px 0 var(--shadow);
  transform: translate(-50%, -20px) scale(.8);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0) scale(1); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes wobble { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-8deg); } 75% { transform: rotate(8deg); } }
@keyframes lost { 0%, 100% { transform: translateX(-14px) rotate(-8deg); } 50% { transform: translateX(14px) rotate(8deg); } }
@keyframes float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes fly { to { transform: translateY(-120vh) rotate(-20deg); opacity: 0; } }

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

@media (max-width: 640px) {
  body { font-size: 15.5px; }
  .hero { flex-direction: column; text-align: center; }
  .hero h1 { font-size: 22px; }
  .article, .archive { padding: 20px 18px; }
  .article-head h1 { font-size: 24px; }
  .post-card { padding: 16px 18px; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav .next { grid-column: 1; }
  .brand-sub { display: none; }
}
