/* ============================================================
   星抖奇玩 — base.css
   设计令牌 / 重置 / 排版系统 / 通用组件
   ============================================================ */

:root {
  /* 品牌色 */
  --ink:    #0B0B0B;
  --paper:  #FAFAF8;
  --accent: #E8FF00;

  /* 主题变量（由 [data-theme] 覆盖） */
  --bg:      var(--ink);
  --fg:      #FFFFFF;
  --fg-dim:  rgba(255, 255, 255, .62);
  --fg-faint:rgba(255, 255, 255, .52);
  --line:    rgba(255, 255, 255, .14);
  --surface: rgba(255, 255, 255, .04);

  /* 尺寸 */
  --wrap: 1440px;
  --pad:  clamp(20px, 5vw, 72px);
  --radius: 4px;

  /* 节奏 */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
          "Microsoft YaHei", "Source Han Sans SC", Inter, system-ui, "Segoe UI",
          Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  color-scheme: dark;
}

[data-theme="dark"] {
  --bg: var(--ink);
  --fg: #FFFFFF;
  --fg-dim: rgba(255, 255, 255, .62);
  --fg-faint: rgba(255, 255, 255, .52);
  --line: rgba(255, 255, 255, .14);
  --surface: rgba(255, 255, 255, .04);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: var(--paper);
  --fg: var(--ink);
  --fg-dim: rgba(11, 11, 11, .62);
  --fg-faint: rgba(11, 11, 11, .56);
  --line: rgba(11, 11, 11, .13);
  --surface: rgba(11, 11, 11, .035);
  color-scheme: light;
}

[data-theme="accent"] {
  --bg: var(--accent);
  --fg: var(--ink);
  --fg-dim: rgba(11, 11, 11, .66);
  --fg-faint: rgba(11, 11, 11, .42);
  --line: rgba(11, 11, 11, .18);
  --surface: rgba(11, 11, 11, .06);
  color-scheme: light;
}

/* ------------------------------------------------------------ reset */

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

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
  /* 用 clip 而非 hidden：hidden 会让 html 成为滚动容器，破坏 .scenes 的 sticky */
  overflow-x: clip;
}

body {
  font-family: var(--font);
  background: var(--ink);
  color: #fff;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
  font-synthesis-weight: none;
}

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

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
ul, ol { list-style: none; }

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

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: #2c2c2c; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #3d3d3d; }

/* ------------------------------------------------------------ 栅格 */

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--pad);
}

section { position: relative; }

/* ------------------------------------------------------------ 排版 */

.sec-label {
  display: inline-flex;
  align-items: center;
  gap: .6em;
  font-family: var(--font-mono);
  font-size: clamp(.68rem, .8vw, .78rem);
  font-weight: 500;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--fg-faint);
  margin-bottom: clamp(20px, 3vw, 36px);
}

.sec-label::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  flex: none;
}

.sec-label--dark { color: rgba(11, 11, 11, .62); }

.sec-title {
  font-size: clamp(2.2rem, 5.6vw, 5.2rem);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -.035em;
  color: var(--fg);
  text-wrap: balance;
}

/* 强调词：浅色底上用「深色字 + 电光黄高亮块」——
   纯黄文字在米白底上对比度不足，无法阅读 */
.sec-title em {
  font-style: normal;
  position: relative;
  color: var(--ink);
  background: var(--accent);
  padding: .04em .18em;
  margin-inline: -.04em;
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
          box-decoration-break: clone;
}

/* 深色底上黄色文字本身就够亮，保持原样 */
[data-theme="dark"] .sec-title em {
  color: var(--accent);
  background: none;
  padding: 0;
  margin-inline: 0;
  border-radius: 0;
}

.sec-head { margin-bottom: clamp(48px, 7vw, 96px); }

.sec-head--split {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: end;
}

.sec-sub {
  font-size: clamp(.95rem, 1.15vw, 1.15rem);
  line-height: 1.75;
  color: var(--fg-dim);
  max-width: 46ch;
  padding-bottom: .5rem;
}

/* ------------------------------------------------------------ 装饰层 */

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, .045) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, .045) 1px, transparent 1px);
  background-size: 88px 88px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 20%, transparent 78%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% 40%, #000 20%, transparent 78%);
}

.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .6s ease;
  background: radial-gradient(
    420px circle at var(--mx, 50%) var(--my, 50%),
    rgba(232, 255, 0, .07),
    transparent 62%
  );
}

body.has-cursor .bg-glow { opacity: 1; }

/* 胶片噪点，削弱纯色块的"塑料感" */
.grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: .05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ------------------------------------------------------------ 通用组件 */

.btn {
  --btn-bg: transparent;
  --btn-fg: var(--fg);
  --btn-border: var(--line);

  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5em;
  padding: 1.05em 2.1em;
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: .01em;
  white-space: nowrap;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1px solid var(--btn-border);
  border-radius: 999px;
  transition: background .35s var(--ease), color .35s var(--ease),
              border-color .35s var(--ease), transform .25s var(--ease);
  will-change: transform;
}

.btn:hover { border-color: var(--fg); }

.btn--accent {
  --btn-bg: var(--accent);
  --btn-fg: var(--ink);
  --btn-border: var(--accent);
}
.btn--accent:hover { --btn-bg: transparent; --btn-fg: var(--accent); }

.btn--ghost:hover { background: rgba(255, 255, 255, .06); }

.btn--ink {
  --btn-bg: var(--ink);
  --btn-fg: var(--accent);
  --btn-border: var(--ink);
}
.btn--ink:hover { --btn-bg: transparent; --btn-fg: var(--ink); }

/* 文本入场：按 --d 依次延迟 */
.anim-rise {
  opacity: 0;
  transform: translateY(24px);
}

.is-ready .anim-rise {
  animation: rise .9s var(--ease-out) forwards;
  animation-delay: var(--d, 0s);
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

/* 滚动揭示（由 main.js 添加 .is-in） */
[data-reveal] {
  opacity: 0;
  transform: translateY(34px);
  transition: opacity .85s var(--ease-out), transform .85s var(--ease-out);
}

[data-reveal].is-in { opacity: 1; transform: none; }

/* 无 JS 时的兜底：内容必须可见 */
.no-js [data-reveal] { opacity: 1; transform: none; }

.no-js .pillar__idx,
.no-js .pillar__title,
.no-js .pillar__desc,
.no-js .tl-item__num,
.no-js .tl-item__title,
.no-js .tl-item__desc { opacity: 1; transform: none; }

.no-js .pillar__title::after { width: 26px; }

/* ------------------------------------------------------------ 无障碍 */

.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;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 200;
  padding: .8em 1.4em;
  background: var(--accent);
  color: var(--ink);
  font-weight: 600;
  border-radius: 0 0 6px 6px;
  transition: top .25s var(--ease);
}
.skip-link:focus { top: 0; }
