/* =========================================================
 * Aeris Field — v9 UI redesign by ui-ux-pro-max
 *
 * Style : Exaggerated Minimalism  + Editorial Grid / Magazine
 * Color : Magazine/Blog  (#18181B editorial black + #FAFAFA paper)
 * Type  : Noto Serif SC (display) + Noto Sans SC (body) + Inter (UI)
 * Pattern: Minimal Single Column landing (hero → desc → CTA → footer)
 *
 * 3D 仍走 v7 per-char + per-cell lift，CSS 只换视觉系统
 * ========================================================= */
:root {
  /* ---- Surface / 色板 ----
   * 来自 ui-ux-pro-max color-domain "Magazine/Blog" */
  --bg:        #FAFAFA;          /* paper-like */
  --surface:   #FFFFFF;
  --tile:      #FFFFFF;
  --tile-edge: rgba(24, 24, 27, 0.05);

  /* 文字 / 控件 */
  --text:        #18181B;        /* editorial black */
  --text-dim:    #3F3F46;
  --text-muted:  #71717A;
  --text-faint:  #A1A1AA;
  --text-on-dark:#FAFAFA;

  --selection-bg: #18181B;
  --selection-fg: #FAFAFA;

  /* Accent (单色，editorial 极简) */
  --accent:      #18181B;

  /* Live indicator */
  --pulse:       #10B981;        /* tailwind emerald-500 */

  /* ---- Type ---- */
  --font-display: "Noto Serif SC", "Inter", "PingFang SC", "Microsoft YaHei", serif;
  --font-body:    "Noto Sans SC", "Inter", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-ui:      "Inter", "Noto Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono:    "JetBrains Mono", "Fira Code", "Consolas", monospace;

  /* Type scale (8px grid + clamp 响应式)
   * display max = 64px → 8 汉字 × 64 = 512px
   * 即使 lift + scale + shadow 拉到极限, 字符顶端 0 → 底端约 110px
   * 与 lead 之间留 var(--sp-8) 48px gap 永远不撞 */
  --type-tag:    0.6875rem;                 /* 11px */
  --type-body:   clamp(0.875rem, 0.7vw + 0.45rem, 1.0625rem);   /* 14 → 17px */
  --type-h2:     clamp(1.0625rem, 0.5vw + 0.95rem, 1.375rem);   /* 17 → 22px */
  --type-display:clamp(1.875rem, 3.2vw + 0.5rem, 4rem);         /* 30 → 64px — 8 汉字 × 64 = 512px */
  --type-note:   0.75rem;                   /* 12px */

  /* ---- Spacing (8px grid) ---- */
  --sp-1:  4px;
  --sp-2:  8px;
  --sp-3:  12px;
  --sp-4:  16px;
  --sp-5:  24px;
  --sp-6:  32px;
  --sp-8:  48px;
  --sp-10: 64px;
  --sp-12: 96px;
  --sp-16: 128px;

  /* ---- Grid geometry ---- */
  --tile-size:   60px;
  --tile-gap-px: 4px;

  /* ---- 3D ---- */
  --perspective:  500px;
  --max-lift:     180px;    /* ↓ 从 220 减, 防止 lifted 字符溢出到 lead */
}

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

::selection {
  background: var(--selection-bg);
  color: var(--selection-fg);
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* 中文断词：句中汉字不被切碎 */
  word-break: keep-all;
  overflow-wrap: break-word;
}

/* =========================================================
 * Stage + surface
 * ========================================================= */
.stage {
  position: fixed;
  inset: 0;
  perspective: var(--perspective);
  perspective-origin: 50% 50%;
  overflow: hidden;
  background: var(--bg);
}

.surface {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  will-change: transform;
  overflow: hidden;
}

/* =========================================================
 * Grid cells
 * ========================================================= */
.grid-layer {
  position: absolute;
  inset: 0;
  display: grid;
  grid-auto-rows: var(--tile-size);
  gap: var(--tile-gap-px);
  transform-style: preserve-3d;
  pointer-events: none;
}

.grid-cell {
  --lift: 0;
  background: var(--tile);
  border-radius: 1px;
  transform-style: preserve-3d;
  transform-origin: center;
  transform:
    translateZ(calc(var(--lift) * var(--max-lift)))
    scale(calc(1 + var(--lift) * 0.22));
  will-change: transform, box-shadow;
  box-shadow:
    0 calc(var(--lift) * 16px) calc(var(--lift) * 24px) rgba(24, 24, 27, calc(0.10 + var(--lift) * 0.40)),
    0 0 0 1px var(--tile-edge);
  z-index: calc(var(--lift) * 100);
}

/* =========================================================
 * Text layer
 * ========================================================= */
.text-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--sp-7) var(--sp-8);    /* 28 / 32 */
  pointer-events: none;
  transform-style: preserve-3d;
}

.text-layer > * {
  transform-style: preserve-3d;
}

.header,
.footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  pointer-events: auto;
  font-family: var(--font-ui);
  font-size: var(--type-note);
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0.02em;
}

[data-lift] {
  --lift: 0;
  transform:
    translateZ(calc(var(--lift) * var(--max-lift)))
    scale(calc(1 + var(--lift) * 0.14));
  transform-style: preserve-3d;
  transform-origin: center;
  will-change: transform, box-shadow;
  z-index: calc(var(--lift) * 100 + 1);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pulse);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
  animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1);   box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18); }
  50%      { transform: scale(1.3); box-shadow: 0 0 0 5px rgba(16, 185, 129, 0.05); }
}

.right {
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: var(--type-note);
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
}

/* =========================================================
 * Main
 * ========================================================= */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: 8vw;
  max-width: 82vw;
  pointer-events: auto;
  transform-style: preserve-3d;
  gap: var(--sp-6);    /* 32 — main 内部元素之间 */
}

.tag,
.lead,
.description,
.description--en,
.lang-divider {
  transform-style: preserve-3d;
}

/* ---- Tag ---- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  font-family: var(--font-ui);
  font-size: var(--type-tag);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-dim);
  align-self: flex-start;
  margin-bottom: 0;
}

.tag-pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pulse);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
  animation: pulse 2.4s ease-in-out infinite;
  flex: 0 0 auto;
}

.tag-sep {
  color: var(--text-faint);
  font-weight: 300;
}

/* ---- Title (display) ---- */
.title {
  position: relative;
  font-family: var(--font-display);
  font-size: var(--type-display);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--text);
  margin: 0 0 var(--sp-6) 0;   /* 32 — 与 lead 之间的硬间距, 兜底防 lift 撞车 */
  padding: 0;
  height: auto;
  width: 100%;
  max-width: max-content;
  transform-style: preserve-3d;
}

.ch {
  --lift: 0;
  position: absolute;
  display: inline-block;
  transform-style: preserve-3d;
  transform-origin: center;
  transform:
    translateZ(calc(var(--lift) * var(--max-lift)))
    scale(calc(1 + var(--lift) * 0.18));
  will-change: transform, box-shadow;
  z-index: calc(var(--lift) * 100 + 2);
  white-space: pre;
  line-height: 1.05;
  top: 0;
  filter:
    drop-shadow(0 calc(var(--lift) * 8px) calc(var(--lift) * 14px) rgba(24, 24, 27, calc(0.10 + var(--lift) * 0.40)));
}

/* ---- Lead (主标题下第一行) ---- */
.lead {
  font-family: var(--font-display);
  font-size: var(--type-h2);
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  letter-spacing: 0.005em;
}

/* ---- Description (主描述) ---- */
.description {
  font-family: var(--font-body);
  font-size: var(--type-body);
  font-weight: 400;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 38em;
  margin: 0;
}

.description--en {
  font-family: var(--font-body);
  color: var(--text-muted);
  font-style: italic;
}

/* ---- EN divider ---- */
.lang-divider {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 12em;
  max-width: 100%;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
}

.lang-divider-line {
  flex: 1;
  height: 1px;
  background: var(--text-faint);
  opacity: 0.4;
}

/* =========================================================
 * Responsive
 * ========================================================= */
@media (max-width: 900px) {
  .text-layer { padding: var(--sp-5) var(--sp-6); }
  .main { margin-left: 5vw; max-width: 90vw; }
}

@media (max-width: 560px) {
  .header, .footer { font-size: 0.6875rem; }
  .description { max-width: 100%; }
}
