/* ============================================================
   YNWA — 克制 Neo-Brutalism：纸色底、黑边、硬阴影
   强调色由 themes.js 在 CSS 前写入；此处是脚本失败时的黄底兜底
   外壳有性格；文章正文保持安静阅读
   ============================================================ */

:root {
  --accent: #ffe135;
  --accent-soft: #fff8d6;
  --accent-2: #ff5a47;
  --on-accent: #0a0a0a;
  --on-accent-2: #0a0a0a;
  --ink: #0a0a0a;
  --black: #000000;
  --paper: #f5f5f0;
  --white: #ffffff;
  --on-ink-muted: #b8b8b0;
  --shadow-sm: 2px 2px 0 var(--black);
  --shadow-md: 3px 3px 0 var(--black);
  --shadow: 4px 4px 0 var(--black);
  --shadow-lg: 6px 6px 0 var(--black);
  --shadow-press: 0 0 0 var(--black);
  --stroke: 3px solid var(--black);
  --stroke-thin: 2px solid var(--black);
  --stripe: repeating-linear-gradient(
    -45deg,
    var(--accent) 0 10px,
    var(--black) 10px 14px,
    var(--accent) 14px 24px
  );
  --stripe-on-ink: repeating-linear-gradient(
    -45deg,
    var(--accent) 0 10px,
    var(--ink) 10px 14px,
    var(--accent) 14px 24px
  );
  --font-head: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;

  --c-label: var(--ink);
  --c-secondary: #4a4a46;
  --c-tertiary: #7a7a74;
  --c-separator: #d8d8d0;
  --c-fill: #ecece4;
  --page-max: 880px;

  /* 正文阅读色，刻意不跟外壳抢 */
  --md-text: #2f353d;
  --md-heading: #1a1d21;
  --md-muted: #7f8792;
  --md-border: #e6e9ee;
  --md-code-bg: #fafbfc;
  --md-inline-code-bg: #f2f4f7;
  --md-code: #48505a;
  --md-table-alt: #fcfcfd;
  --md-link: #3e7dd6;
  --md-link-hover: #2f6fc8;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-padding-top: 88px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--c-label);
  overflow-x: hidden;
  background:
    radial-gradient(circle at 1.5px 1.5px, rgba(0, 0, 0, 0.07) 1.2px, transparent 0) 0 0 / 22px 22px,
    var(--paper);
}

::selection {
  background: var(--accent);
  color: var(--on-accent);
}

a {
  cursor: pointer;
}

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

h1, h2, h3, h4 {
  font-family: var(--font-head);
  font-weight: 800;
  letter-spacing: -0.02em;
}

#root {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-bottom: 48px;
}

@media (min-width: 768px) {
  #main {
    padding-bottom: 64px;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -80px;
  z-index: 1001;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  padding: 10px 16px;
  border: var(--stroke);
  box-shadow: var(--shadow);
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ---------- 页面骨架 / 共用排版 ---------- */

/* 内容宽 + 水平内边距：内页、首页区块、顶栏共用 */
.page,
.wrap,
.site-header-inner {
  width: 100%;
  max-width: var(--page-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 16px;
  padding-right: 16px;
}

.page {
  flex: 1;
}

.page--center {
  display: flex;
  align-items: center;
}

.page-hero {
  padding: 32px 0 28px;
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 4px 10px;
  background: var(--white);
  border: var(--stroke-thin);
}

.page-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.page-desc {
  margin: 10px 0 0;
  font-size: 17px;
  font-weight: 400;
  color: var(--c-secondary);
  line-height: 1.625;
  max-width: 36em;
}

@media (min-width: 768px) {
  .page,
  .wrap,
  .site-header-inner {
    padding-left: 32px;
    padding-right: 32px;
  }

  .page-hero {
    padding-top: 48px;
  }

  .page-title {
    font-size: 40px;
  }
}

/* ---------- 共用按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-head);
  font-size: 15px;
  font-weight: 800;
  padding: 12px 22px;
  border: var(--stroke);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow);
  cursor: pointer;
  text-decoration: none;
  min-height: 48px;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-lg);
}

.btn:active {
  transform: translate(4px, 4px);
  box-shadow: var(--shadow-press);
}

.btn--sm {
  font-size: 14px;
  padding: 8px 12px;
  min-height: 0;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
  white-space: nowrap;
}

.btn--sm:hover {
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow);
}

.btn--sm:active {
  transform: translate(3px, 3px);
  box-shadow: var(--shadow-press);
}

.btn-ghost {
  background: var(--white);
  color: var(--ink);
}

.btn-ink {
  background: var(--ink);
  color: var(--paper);
}

/* ---------- 共用区块标题 ---------- */

.section-title {
  margin: 12px 0 0;
  font-size: clamp(28px, 5vw, 40px);
  font-weight: 800;
  letter-spacing: -0.03em;
}

.section-title--lg {
  font-size: clamp(32px, 5vw, 44px);
}

.section-title--display {
  font-size: clamp(32px, 6vw, 52px);
  margin: 16px 0 14px;
  line-height: 1.15;
}

/* ---------- 共用 chip ---------- */

.chip {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  padding: 3px 8px;
  background: var(--white);
  border: var(--stroke-thin);
  text-decoration: none;
  transition: background 0.12s ease;
}

.chip:hover:not(.chip--static) {
  background: var(--accent);
  color: var(--on-accent);
}

.chip--static {
  cursor: default;
}

/* 置顶徽标：贴 accent，字色走 --on-accent，避免深色主题日隐身 */
.chip--pin {
  background: var(--accent);
  color: var(--on-accent);
  letter-spacing: 0.08em;
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .article-card:hover,
  .icon-btn:hover,
  .page-btn:hover,
  .search-input:focus,
  .btn:hover,
  a.bento-card:hover {
    transform: none;
  }
}
