/* ==========================================================================
   home-showcase.css · 首页主视觉与高级动效（V2.1，只被 index.html 引用）
   --------------------------------------------------------------------------
   计划：LEGEND1SWEB-HOME-SHOWCASE-EXECUTION-PLAN-v1（光场首屏 + 精致工作台 + 电影感热爱区）。
   约束：
     · 每条规则都以 body.home-showcase 开头，不改 :root 公共变量，不影响其它页面；
     · 颜色只读既有令牌（--brand-1 / --brand-2 / --surface …），主题工作室换色照样传递；
     · 原有首屏动画（标题 fx-mask-in、说明 / 搜索 / 概览 fx-rise，css/motion.css）原样保留，
       这里只加新层：轨道入场、强调词高光一次、热爱图揭幕；同一元素同一属性只有一个动画源；
     · 动效门控与全站一致：@media (prefers-reduced-motion: no-preference) + :root:not([data-motion="reduce"])；
       不新增无限循环；不用 backdrop-filter（全站只留顶栏与手机抽屉两处）。
   ========================================================================== */

/* ---------- 1. 首屏：舞台与标题 ---------- */
body.home-showcase .hero {
  isolation: isolate;
  overflow-x: clip;          /* 轨道比视口宽时只裁横向，不产生滚动条，也不裁焦点环 */
  padding-block: clamp(1.75rem, 4vw, 3rem) clamp(1.5rem, 3.5vw, 2.75rem);
}
body.home-showcase .hero__title {
  font-size: clamp(2rem, 0.9rem + 3.4vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  text-wrap: balance;
}
/* 两组：「常用网站与工具，」一行，「一处直达。」一行 */
body.home-showcase .hero__title-lead { display: block; width: fit-content; margin-inline: auto; }
html[data-labs~="dashboard"] body.home-showcase .hero__title-lead { margin-inline: 0; }
body.home-showcase .hero__title .text-gradient { position: relative; }

/* ---------- 2. 品牌轨道（装饰层） ---------- */
body.home-showcase .home-orbit {
  --home-hi: rgba(255, 255, 255, 0.06);
  position: absolute;
  z-index: -1;
  top: 50%;
  left: 50%;
  width: min(620px, 92vw);
  aspect-ratio: 1;
  translate: -50% -50%;
  opacity: 0.3;              /* 居中版式（工作台关闭）垫在标题和搜索后面，压低存在感 */
  pointer-events: none;
}
/* 工作台打开（首屏两栏）：轨道在右侧「今日概览」后方，从面板四周露出来 */
@media (min-width: 901px) {
  html[data-labs~="dashboard"] body.home-showcase .home-orbit {
    left: auto;
    right: max(-120px, calc((100% - var(--container)) / 2 - 110px));
    width: min(600px, 46vw);
    opacity: 1;
    translate: 0 -50%;
  }
}
/* 窄屏：缩成标题后方的低对比背景 */
@media (max-width: 900px) {
  body.home-showcase .home-orbit { top: 0; left: auto; right: -34%; width: min(520px, 120vw); translate: 0 -18%; opacity: 0.4; }
}

body.home-showcase .home-orbit__tilt {
  width: 100%;
  height: 100%;
  transform: translate3d(var(--home-x, 0px), var(--home-y, 0px), 0) rotate(var(--home-r, 0deg));
}
body.home-showcase .home-orbit__svg { display: block; width: 100%; height: 100%; overflow: visible; }

body.home-showcase .home-orbit__stop-glow { stop-color: var(--brand-1); stop-opacity: 0.3; }
body.home-showcase .home-orbit__stop-clear { stop-color: var(--brand-1); stop-opacity: 0; }
body.home-showcase .home-orbit__stop-a { stop-color: var(--brand-1); }
body.home-showcase .home-orbit__stop-b { stop-color: var(--brand-2); }
body.home-showcase .home-orbit__glow { fill: url(#homeOrbitGlow); }
body.home-showcase .home-orbit__ring { fill: none; vector-effect: non-scaling-stroke; }
body.home-showcase .home-orbit__ring--main { stroke: url(#homeOrbitLine); stroke-width: 1.5; opacity: 0.75; }
body.home-showcase .home-orbit__ring--soft { stroke: var(--brand-2); stroke-width: 1; opacity: 0.32; }
body.home-showcase .home-orbit__ring--dash { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 2 7; }
body.home-showcase .home-orbit__dot--a { fill: var(--brand-2); }
body.home-showcase .home-orbit__dot--b { fill: var(--brand-1); }
body.home-showcase .home-orbit__dot--c { fill: var(--text-faint); }
body.home-showcase .home-orbit__mark { fill: url(#homeOrbitLine); opacity: 0.2; }

/* 浅色：银白冰蓝，光更淡、线更清楚 */
:root[data-theme="light"] body.home-showcase .home-orbit { --home-hi: rgba(255, 255, 255, 0.9); }
:root[data-theme="light"] body.home-showcase .home-orbit__stop-glow { stop-color: var(--brand-2); stop-opacity: 0.22; }
:root[data-theme="light"] body.home-showcase .home-orbit__mark { opacity: 0.14; }

/* ---------- 3. 搜索与今日概览：细边框 + 静态内高光 ---------- */
body.home-showcase { --home-hi: rgba(255, 255, 255, 0.06); }
:root[data-theme="light"] body.home-showcase { --home-hi: rgba(255, 255, 255, 0.95); }
/* 悬停与聚焦时让位给原有样式（layout.css 的阴影与焦点环），这里只管静止状态 */
body.home-showcase .hero__search:not(:hover):not(:focus-within) {
  box-shadow: inset 0 1px 0 var(--home-hi), var(--shadow-sm);
}
html[data-labs~="dashboard"] body.home-showcase .hero__today {
  background:
    /* 有限透明：后面的轨道只在面板内隐约可见，不穿过数字与说明 */
    linear-gradient(180deg, color-mix(in srgb, var(--surface-strong) 92%, var(--bg-elev)), color-mix(in srgb, var(--bg-elev) 90%, transparent));
  box-shadow: inset 0 1px 0 var(--home-hi), var(--shadow-sm);
}

/* ---------- 4. 热爱区材质：曼城冰蓝边缘光，红牛细红强调 ---------- */
body.home-showcase .passion-card--city {
  box-shadow: inset 0 0 0 1px rgba(152, 197, 232, 0.55), 0 22px 46px -30px rgba(11, 107, 168, 0.6);
}
body.home-showcase .passion-card--racing {
  box-shadow: inset 0 0 0 1px rgba(229, 35, 61, 0.22), 0 22px 46px -30px rgba(0, 0, 0, 0.8);
}
/* 红牛的速度线：平时不显示，悬停时短促掠过一次（见第 5 节） */
body.home-showcase .passion-card--racing::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, transparent, rgba(229, 35, 61, 0.8), transparent) 0 20% / 36% 1px no-repeat,
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.55), transparent) 0 27% / 24% 1px no-repeat,
    linear-gradient(90deg, transparent, rgba(229, 35, 61, 0.6), transparent) 0 34% / 30% 1px no-repeat;
  opacity: 0;
}

/* ==========================================================================
   5. 动效（只在允许动效时）
   ========================================================================== */
@keyframes home-orbit-in {
  from { opacity: 0; scale: 0.92; }
}
@keyframes home-sheen {
  from { background-position: -120% 0; }
  to   { background-position: 220% 0; }
}
@keyframes home-orbit-out {
  to { opacity: 0.3; scale: 0.94; }
}
@keyframes home-passion-in {
  from { scale: 1.04; }
}
@keyframes home-scrim-in {
  from { translate: 0 16%; }
}
@keyframes home-speed {
  from { opacity: 1; transform: translateX(-40%); }
  to   { opacity: 0; transform: translateX(120%); }
}

@media (prefers-reduced-motion: no-preference) {
  /* 轨道入场：0–700ms，透明度与小幅缩放，一次 */
  :root:not([data-motion="reduce"]) body.home-showcase .home-orbit__svg {
    animation: home-orbit-in 700ms var(--ease-out) backwards;
  }
  /* 指针视差的回弹：JS 只写目标值，过渡负责平滑；离开时回到 0 */
  :root:not([data-motion="reduce"]) body.home-showcase .home-orbit__tilt {
    transition: transform 700ms var(--ease-out);
  }
  /* 强调词高光：约 650–1350ms 经过一次，只落在文字上（background-clip: text）。
     复制的文字用 content 的替代文本写成空串，读屏不会读两遍；不支持这种写法的浏览器整条声明失效，没有高光。 */
  :root:not([data-motion="reduce"]) body.home-showcase .hero__title .text-gradient::after {
    content: attr(data-sheen) / "";
    position: absolute;
    inset: 0;
    white-space: nowrap;
    pointer-events: none;
    color: transparent;
    background: linear-gradient(100deg, transparent 35%, rgba(255, 255, 255, 0.85) 50%, transparent 65%) no-repeat;
    background-size: 50% 100%;
    background-position: -120% 0;
    -webkit-background-clip: text;
    background-clip: text;
    animation: home-sheen 700ms var(--ease-in-out) 650ms both;
  }
  /* 热爱图揭幕：第一次进入视口时（js/home-showcase.js 给 .passion-grid 加 .home-in，只加一次），
     图片外层从 1.04 回到 1、遮罩轻轻上移到位。用独立的 scale / translate，
     不碰悬停放大的 transform，也不碰 img 上的滚动视差 */
  :root:not([data-motion="reduce"]) body.home-showcase .passion-grid.home-in .passion-card__media {
    animation: home-passion-in 650ms var(--ease-out) backwards;
  }
  :root:not([data-motion="reduce"]) body.home-showcase .passion-grid.home-in .passion-card__media::after {
    animation: home-scrim-in 650ms var(--ease-out) backwards;
  }
  :root:not([data-motion="reduce"]) body.home-showcase .passion-grid.home-in .passion-card:nth-child(2) .passion-card__media,
  :root:not([data-motion="reduce"]) body.home-showcase .passion-grid.home-in .passion-card:nth-child(2) .passion-card__media::after {
    animation-delay: 90ms;
  }
  /* 悬停：图片最大 1.04，箭头 4px，红牛速度线掠过一次 */
  @media (hover: hover) {
    html[data-labs~="dashboard"]:not([data-motion="reduce"]) body.home-showcase .passion-card:hover .passion-card__media { transform: scale(1.04); }
    :root:not([data-motion="reduce"]) body.home-showcase .passion-card:hover .passion-card__arrow { transform: translateX(4px); }
    :root:not([data-motion="reduce"]) body.home-showcase .passion-card--racing:hover::after {
      animation: home-speed 520ms var(--ease-out) both;
    }
  }
}

/* 首屏退出：装饰随自然滚动减弱，功能内容不动；不支持滚动时间线时保持静态 */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    :root:not([data-motion="reduce"]) body.home-showcase .home-orbit {
      animation: home-orbit-out linear both;
      animation-timeline: view();
      animation-range: exit 0% exit 100%;
    }
  }
}

@media (forced-colors: active) {
  body.home-showcase .home-orbit,
  body.home-showcase .passion-card--racing::after { display: none; }
}
