/* ==========================================================================
   InfiStudio Design Tokens — V2 共享设计系统
   官网 (infistudio-v2.html) 与教程 (guide.html) 共用同一套变量。
   基调延续 V1 暗金电影质感，扩展为完整 token 体系。
   ========================================================================== */

:root {
  /* ---- 背景与表面 ---------------------------------------------------- */
  --bg: #090705;
  --bg-deep: #050403;
  --bg-soft: #0f0b08;
  --surface-1: rgba(255, 255, 255, 0.025);
  --surface-2: rgba(255, 255, 255, 0.045);
  --surface-3: rgba(255, 255, 255, 0.07);
  --panel: rgba(24, 18, 13, 0.78);
  --panel-strong: #17100c;
  --glass: rgba(16, 11, 8, 0.78);

  /* ---- 墨色（文字）-------------------------------------------------- */
  --ink: #fff6e8;
  --ink-soft: #cabdaf;
  --ink-muted: #8d8174;
  --ink-faint: #6b6258;

  /* ---- 金色主色阶 --------------------------------------------------- */
  --gold: #e8a85c;
  --gold-bright: #ffc472;
  --gold-deep: #8a5524;
  --gold-100: #fbe6c8;
  --gold-200: #f6cf9a;
  --gold-300: #efb673;
  --gold-400: #e8a85c;
  --gold-500: #d18f44;
  --gold-600: #a96f30;

  /* ---- 语义色 ------------------------------------------------------- */
  --success: #6fcf97;
  --success-soft: rgba(111, 207, 151, 0.14);
  --warn: #f2c94c;
  --warn-soft: rgba(242, 201, 76, 0.14);
  --info: #7cb8e6;
  --info-soft: rgba(124, 184, 230, 0.14);
  --danger: #eb6f6f;
  --danger-soft: rgba(235, 111, 111, 0.14);

  /* ---- 线条与阴影 --------------------------------------------------- */
  --line: rgba(255, 232, 201, 0.12);
  --line-soft: rgba(255, 232, 201, 0.07);
  --line-strong: rgba(232, 168, 92, 0.34);
  --shadow: rgba(0, 0, 0, 0.48);
  --elev-1: 0 8px 24px rgba(0, 0, 0, 0.32);
  --elev-2: 0 18px 46px rgba(0, 0, 0, 0.4);
  --elev-3: 0 46px 100px rgba(0, 0, 0, 0.5);
  --glow-gold: 0 14px 36px rgba(232, 168, 92, 0.22);
  --glow-gold-strong: 0 18px 54px rgba(232, 168, 92, 0.34);

  /* ---- 字体族 ------------------------------------------------------- */
  --font-display: "Fraunces", "Noto Serif SC", "Songti SC", serif;
  --font-serif-cn: "Noto Serif SC", "Songti SC", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Fraunces", ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;

  /* ---- 字阶 scale --------------------------------------------------- */
  --text-xs: 12px;
  --text-sm: 13px;
  --text-base: 15px;
  --text-md: 16px;
  --text-lg: 18px;
  --text-xl: clamp(20px, 2vw, 24px);
  --text-2xl: clamp(24px, 2.6vw, 32px);
  --text-3xl: clamp(28px, 3.2vw, 44px);
  --text-4xl: clamp(34px, 4.2vw, 58px);
  --text-5xl: clamp(42px, 6vw, 82px);
  --text-hero: clamp(48px, 6vw, 80px);

  /* ---- 间距 scale（4px 基准）-------------------------------------- */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;
  --sp-8: 64px;
  --sp-9: 80px;
  --sp-10: 112px;
  --section-y: clamp(76px, 9vw, 112px);

  /* ---- 圆角 --------------------------------------------------------- */
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --radius-xl: 34px;
  --radius-pill: 999px;

  /* ---- 动效 timing -------------------------------------------------- */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 0.18s;
  --dur-base: 0.25s;
  --dur-slow: 0.8s;

  /* ---- 布局 --------------------------------------------------------- */
  --container: 1180px;
  --container-wide: 1380px;
  --header-h: 68px;
}

/* 断点参考（媒体查询里用字面值）：
   >1440 大屏 · 1280 笔记本 · 1040 平板 · 760 大手机 · 480 小手机 */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 52% 8%, rgba(232, 168, 92, 0.2), transparent 30rem),
    radial-gradient(circle at 86% 34%, rgba(138, 85, 36, 0.18), transparent 28rem),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 38%, #0d0906 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* 全局电影颗粒噪点层 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0.045;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.7'/></svg>");
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
}

::selection {
  background: rgba(232, 168, 92, 0.28);
  color: var(--ink);
}

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

.container {
  width: min(var(--container), calc(100% - 48px));
  margin: 0 auto;
}
.container-wide {
  width: min(var(--container-wide), calc(100% - 48px));
  margin: 0 auto;
}

/* 进场动效（IntersectionObserver 添加 .in） */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slow) var(--ease-out);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
.reveal[data-reveal-delay="1"] { transition-delay: 0.08s; }
.reveal[data-reveal-delay="2"] { transition-delay: 0.16s; }
.reveal[data-reveal-delay="3"] { transition-delay: 0.24s; }
.reveal[data-reveal-delay="4"] { transition-delay: 0.32s; }
.reveal[data-reveal-delay="5"] { transition-delay: 0.4s; }

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

@media (max-width: 760px) {
  :root {
    --header-h: 60px;
  }
  .container,
  .container-wide {
    width: min(100% - 32px, var(--container-wide));
  }
}
