/* ==========================================================================
   Doge 主题 · 第 1 层:设计令牌 + 重置 + 基础排版

   文件分工(规格 5 节):本层只放全局变量、重置与正文排版。
   版式(头部/页脚/栅格/侧栏)在 layout.css;
   卡片/气泡/按钮/评论/代码块在 components.css;
   全部关键帧动画在 animations.css。改哪层开哪个文件。
   ========================================================================== */

/* --- 自托管字体 ----------------------------------------------------------
   不用任何外部字体服务(规格 4.1)。用相对路径而非绝对 URL,域名变更或
   本地/线上切换都不会失效。刻意**不做** preload:得意黑体积大,预热反而拖慢首屏。
   -------------------------------------------------------------------------- */

@font-face {
  font-family: 'Smiley Sans';
  src: url('../fonts/smiley-sans/SmileySans-Oblique.ttf.woff2') format('woff2');
  /* 得意黑只有一个字重。声明覆盖全字重区间,让所有字重都直接命中真实字体,
     避免浏览器合成粗体——合成粗体在中文上会糊成一团。 */
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono/JetBrainsMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/jetbrains-mono/JetBrainsMono-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- 设计令牌(规格 6.1 配色 / 6.3 尺度) ------------------------------ */

:root {
  /* 配色。深色模式不在 v1 范围,但颜色全部走变量,后续只需补一组变量值。 */
  --cream: #FFFBF0;
  --paper: #FFFFFF;
  --tan: #E8CDA4;
  --tan-deep: #C8A06A;
  --brown: #4A3B2A;
  --ink: #241E18;
  --mustard: #F2B33D;
  --coral: #EE6C4D;
  --sky: #4A90D9;
  --mint: #59B87C;

  /* 字体栈。正文**不**用得意黑,长文可读性优先;得意黑只出现在字数少的标题与按钮上。 */
  --font-display: 'Smiley Sans', 'Comic Sans MS', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: system-ui, -apple-system, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
  --font-meme: 'Comic Sans MS', cursive;
  --font-mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;

  /* 贴纸感三件套:粗描边 + 硬阴影(实心偏移,不是模糊) + 统一圆角。
     所有卡片、按钮、气泡共用,不允许出现圆润柔和的现代卡片风格。 */
  --radius: 6px;
  --border: 2px solid var(--ink);
  --border-thin: 2px solid var(--tan-deep);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-sm: 2px 2px 0 var(--ink);

  /* 正文单栏的最大行宽(规格 6.3) */
  --content-width: 720px;

  /* 整页容器宽度(含侧栏)。比正文宽,好让侧栏有地方站。 */
  --page-width: 1180px;
}

/* 断点(移动优先):1080px 收起侧栏、720px 单列。CSS 变量进不了媒体查询,
   实际值直接写在 layout.css 里,这里只作说明。 */

/* --- 轻量重置 ----------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body,
h1, h2, h3, h4, h5, h6,
p, figure, blockquote, dl, dd, ul, ol, pre {
  margin: 0;
}

/* 注意:这里不归零 ul/ol 的 padding —— 正文里的列表要靠它缩进。
   导航之类的无衬线列表由 layout.css 自己 `list-style: none; padding: 0`。 */

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

table {
  border-collapse: collapse;
}

/* --- 基础排版(规格 6.3) --------------------------------------------- */

body {
  background: var(--cream);
  color: var(--brown);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.75;
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--ink);
  line-height: 1.2;
}

h1 { font-size: 40px; }
h2 { font-size: 30px; }
h3 { font-size: 22px; }
h4, h5, h6 { font-size: 18px; }

a {
  color: inherit;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--mustard);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--coral);
}

code, kbd, pre, samp {
  font-family: var(--font-mono);
}

pre {
  overflow-x: auto;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

blockquote, figure {
  margin: 1.5em 0;
}

@media (max-width: 720px) {
  body { font-size: 17px; }
  h1 { font-size: 32px; }
  h2 { font-size: 25px; }
  h3 { font-size: 20px; }
}

/* --- 可访问性(规格 14) ---------------------------------------------- */

/* 「跳到主内容」。平时移出视口,键盘用户聚焦时才现身。 */
.doge-skip-link {
  position: absolute;
  top: -120px;
  left: 0;
  z-index: 999;
  padding: 10px 16px;
  background: var(--mustard);
  color: var(--ink);
  font-family: var(--font-display);
  text-decoration: none;
  border: var(--border);
  border-radius: var(--radius);
}

.doge-skip-link:focus {
  top: 8px;
  left: 8px;
}

/* 沿用 --ink 的粗描边,键盘导航时清晰可见。 */
:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

/* --- 动效偏好(规格 14) ---------------------------------------------- */

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