/* =============================================================================
 * 天天美味铺 · Web 版 —— 基础层 Base
 * -----------------------------------------------------------------------------
 * 职责：CSS Reset、文档级排版、布局容器、通用工具类、关键帧动画库。
 * 依赖：tokens.css（必须先引入）
 * ========================================================================== */

/* =============================================================================
 * 1. Reset —— 抹平浏览器差异
 * ========================================================================== */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* 固定导航栏遮挡锚点时的舒适偏移 */
  scroll-padding-top: calc(var(--nav-h) + 16px);
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  color: var(--text-1);
  background-color: var(--c-cream);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* 3D 画布与卡片阴影需要稳定的层叠上下文 */
  position: relative;
  min-height: 100vh;
}

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

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

button {
  background: none;
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

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

ul,
ol { list-style: none; }

::selection {
  background: rgba(255, 90, 54, .22);
  color: var(--c-ink);
}

/* 键盘可达性：仅在键盘导航时显示焦点圈 */
:focus-visible {
  outline: 2px solid var(--c-brand);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* 自定义滚动条（Chromium / WebKit） */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(38, 50, 56, .18);
  border-radius: var(--r-full);
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(38, 50, 56, .32); background-clip: content-box; }

/* =============================================================================
 * 2. 排版 Typography
 * ========================================================================== */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-semi);
  line-height: var(--lh-snug);
  letter-spacing: var(--ls-tight);
  color: var(--text-1);
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }

p { color: var(--text-2); }

strong, b { font-weight: var(--fw-semi); color: var(--text-1); }

/* 超大展示标题：Apple / DJI 式的大字收字距 */
.t-display {
  font-family: var(--font-display);
  font-size: var(--fs-display);
  font-weight: var(--fw-black);
  line-height: var(--lh-tight);
  letter-spacing: var(--ls-mega);
}

/* 小标签：全大写 + 宽字距 */
.t-eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--c-brand);
}

.t-gradient {
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.t-muted { color: var(--text-3); }
.t-lead { font-size: var(--fs-lead); line-height: var(--lh-loose); color: var(--text-2); }
.t-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.t-nowrap { white-space: nowrap; }

/* 数字统一等宽，避免计数动画抖动 */
.t-num { font-variant-numeric: tabular-nums; letter-spacing: var(--ls-tight); }

/* =============================================================================
 * 3. 布局 Layout
 * ========================================================================== */
.l-container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--page-x);
}

.l-container--wide { max-width: var(--container-wide); }
.l-container--narrow { max-width: var(--container-narrow); }

.l-section {
  position: relative;
  padding-block: var(--section-y);
}

.l-section--sm { padding-block: var(--section-y-sm); }

/* 深色分区：自动继承白色文字语义变量 */
.l-section--ink {
  background: var(--grad-ink);
  color: var(--c-white);
  --text-1: var(--c-white);
  --text-2: var(--c-white-64);
  --text-3: var(--c-white-34);
  --c-line: var(--c-line-invert);
}

.l-stack { display: flex; flex-direction: column; }
.l-stack--4 { gap: var(--sp-4); }
.l-stack--6 { gap: var(--sp-6); }
.l-stack--8 { gap: var(--sp-8); }

.l-row { display: flex; align-items: center; }
.l-row--between { justify-content: space-between; }
.l-row--center { justify-content: center; }
.l-row--wrap { flex-wrap: wrap; }
.l-gap-2 { gap: var(--sp-2); }
.l-gap-3 { gap: var(--sp-3); }
.l-gap-4 { gap: var(--sp-4); }
.l-gap-6 { gap: var(--sp-6); }

/* 通用网格：自适应列宽，全站卡片区复用 */
.l-grid {
  display: grid;
  gap: var(--sp-6);
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.l-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* =============================================================================
 * 4. 装饰与材质 Overlay
 * ========================================================================== */

/* 米白底的柔和径向光晕，让大面积留白不显空 */
.l-aura::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(680px 420px at 12% 0%, rgba(255, 90, 54, .10), transparent 68%),
    radial-gradient(560px 380px at 92% 18%, rgba(255, 61, 46, .08), transparent 70%);
  z-index: -1;
}

/* 细网格纹理，增强「材质感」 */
.l-grid-texture::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .5;
  background-image:
    linear-gradient(rgba(38, 50, 56, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(38, 50, 56, .045) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 50% 30%, #000 0%, transparent 78%);
  z-index: -1;
}

/* =============================================================================
 * 5. 工具类 Utilities
 * ========================================================================== */
.u-hidden { display: none !important; }
.u-sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.u-text-center { text-align: center; }
.u-mx-auto { margin-inline: auto; }
.u-mt-4 { margin-top: var(--sp-4); }
.u-mt-6 { margin-top: var(--sp-6); }
.u-mt-8 { margin-top: var(--sp-8); }
.u-full { width: 100%; }

/* =============================================================================
 * 6. 关键帧动画库 Keyframes
 * ========================================================================== */
@keyframes wm-float {
  0%, 100% { transform: translate3d(0, 0, 0); }
  50%      { transform: translate3d(0, -14px, 0); }
}

@keyframes wm-float-slow {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50%      { transform: translate3d(0, -22px, 0) rotate(2.5deg); }
}

@keyframes wm-pulse-ring {
  0%   { transform: scale(.82); opacity: .75; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { transform: scale(1.35); opacity: 0; }
}

@keyframes wm-shimmer {
  0%   { background-position: -180% 0; }
  100% { background-position: 180% 0; }
}

@keyframes wm-marquee {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

@keyframes wm-spin-slow {
  to { transform: rotate(360deg); }
}

@keyframes wm-scroll-hint {
  0%   { transform: translateY(-2px); opacity: 0; }
  35%  { opacity: 1; }
  100% { transform: translateY(12px); opacity: 0; }
}

@keyframes wm-fade-up {
  from { opacity: 0; transform: translate3d(0, 26px, 0); }
  to   { opacity: 1; transform: none; }
}

@keyframes wm-pop {
  0%   { transform: scale(.6); opacity: .4; }
  60%  { transform: scale(1.16); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes wm-grow-x {
  0%   { transform: scaleX(0); }
  70%  { transform: scaleX(1); }
  100% { transform: scaleX(1); opacity: 0; }
}

@keyframes wm-skeleton {
  0%   { background-position: 140% 0; }
  100% { background-position: -40% 0; }
}

/* 极光呼吸：Hero / CTA 的底色光斑缓慢明暗流动 */
@keyframes wm-aurora {
  0%   { transform: translate3d(0, 0, 0) scale(1);    opacity: .85; }
  50%  { transform: translate3d(2%, -1.5%, 0) scale(1.06); opacity: 1; }
  100% { transform: translate3d(-1.5%, 2%, 0) scale(1.02); opacity: .9; }
}

/* 动画工具类 */
.a-float { animation: wm-float 6s var(--ease-in-out) infinite; }
.a-float-slow { animation: wm-float-slow 9s var(--ease-in-out) infinite; }
.a-spin-slow { animation: wm-spin-slow 36s linear infinite; }
.a-fade-up { animation: wm-fade-up var(--dur-4) var(--ease-out-expo) both; }

/* =============================================================================
 * 7. 滚动揭示 Reveal（由 scroll-anim.js 添加 .is-in）
 * ========================================================================== */
[data-reveal] {
  opacity: 0;
  transform: translate3d(0, 34px, 0);
  transition:
    opacity var(--dur-4) var(--ease-out-expo),
    transform var(--dur-4) var(--ease-out-expo);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
[data-reveal="left"]  { transform: translate3d(-46px, 0, 0); }
[data-reveal="right"] { transform: translate3d(46px, 0, 0); }
[data-reveal="zoom"]  { transform: scale(.92); }
[data-reveal="blur"]  { filter: blur(14px); transform: translate3d(0, 24px, 0); }

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

/* 视差元素：由 JS 写入 --py（像素位移） */
[data-parallax] {
  transform: translate3d(0, var(--py, 0px), 0);
  will-change: transform;
}

/* =============================================================================
 * 8. 无障碍降级：尊重 prefers-reduced-motion
 * ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

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

  [data-reveal],
  [data-parallax] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
}
