/* ==========================================================
   星欧娱乐 · 星欧平台 —— base.css
   设计基调：档案纸 / 墨色 / 朱印 / 黄铜刻度
   仅负责：设计变量、重置、排版基座、无障碍工具类
   ========================================================== */

:root {
  /* 纸与墨 */
  --xo-paper: #f4efe4;
  --xo-paper-2: #ece5d6;
  --xo-paper-3: #e3dac7;
  --xo-ink: #161a1d;
  --xo-ink-2: #2b3236;
  --xo-ink-3: #4a5459;
  --xo-ink-4: #6d777c;
  --xo-night: #101417;
  --xo-night-2: #1a2126;

  /* 强调 */
  --xo-seal: #a13127;
  --xo-seal-2: #c05a4d;
  --xo-brass: #a2844a;
  --xo-olive: #4d5b49;

  /* 线 */
  --xo-line: rgba(22, 26, 29, 0.13);
  --xo-line-2: rgba(22, 26, 29, 0.28);
  --xo-line-light: rgba(244, 239, 228, 0.16);

  /* 尺度 */
  --rail-w: 252px;
  --shell-max: 1180px;
  --gut: clamp(18px, 4vw, 64px);
  --r-s: 2px;
  --r-m: 4px;

  /* 字体 */
  --f-serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", Georgia, serif;
  --f-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Mono", Consolas, "Courier New", monospace;

  /* 动效 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 24px;
}

body {
  margin: 0;
  background-color: var(--xo-paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(162, 132, 74, 0.07), transparent 42%),
    radial-gradient(circle at 88% 0%, rgba(77, 91, 73, 0.08), transparent 38%);
  color: var(--xo-ink-2);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.78;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 纸纹：极轻的噪点，避免大色块显得塑料 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.42;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E");
}

h1,
h2,
h3,
h4 {
  font-family: var(--f-serif);
  font-weight: 600;
  color: var(--xo-ink);
  line-height: 1.3;
  letter-spacing: 0.02em;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(1.9rem, 3.6vw, 3.05rem);
}

h2 {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

h3 {
  font-size: 1.12rem;
}

p {
  margin: 0 0 1em;
}

a {
  color: var(--xo-ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(161, 49, 39, 0.32);
  transition: color 0.24s var(--ease), border-color 0.24s var(--ease);
}

a:hover,
a:focus-visible {
  color: var(--xo-seal);
  border-bottom-color: var(--xo-seal);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul,
ol {
  margin: 0 0 1em;
  padding-left: 1.25em;
}

li {
  margin: 0.25em 0;
}

strong {
  color: var(--xo-ink);
  font-weight: 600;
}

em {
  font-style: normal;
}

hr {
  border: 0;
  border-top: 1px solid var(--xo-line);
  margin: 2.5em 0;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

::selection {
  background: rgba(161, 49, 39, 0.16);
  color: var(--xo-ink);
}

:focus-visible {
  outline: 2px solid var(--xo-seal);
  outline-offset: 3px;
}

/* ---------- 排版工具 ---------- */

.xo-mono {
  font-family: var(--f-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.xo-rule {
  height: 1px;
  background: var(--xo-line-2);
  border: 0;
}

.xo-dot {
  margin: 0 0.5em;
  color: var(--xo-ink-4);
}

.xo-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 120;
  padding: 10px 18px;
  background: var(--xo-ink);
  color: var(--xo-paper);
  border: 0;
}

.xo-skip:focus {
  left: 12px;
  top: 12px;
}

/* 阅读进度条 */
.xo-progress {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 2px;
  z-index: 90;
  background: transparent;
  pointer-events: none;
}

.xo-progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--xo-seal), var(--xo-brass));
  transition: width 0.12s linear;
}

/* 回顶 */
.xo-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: var(--xo-ink);
  color: var(--xo-paper);
  border: 0;
  border-radius: 50%;
  font-size: 1rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease), visibility 0.3s;
}

.xo-top.is-on {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.xo-top:hover {
  background: var(--xo-seal);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
