/* ==========================================================
   JR杰瑞 · 首屏入口层 landing.css  (v1.0 / 2026-09-07)
   ------------------------------------------------------------
   形态：固定覆盖层（overlay），左右两片幕布向两侧拉开，露出下方官网
   关键：position:fixed + 不占文档流 → 零 CLS；官网正文始终在 DOM 中 → 零 SEO 损失
   接入：与 motion.css 一起引入，顺序 brand.css → motion.css → landing.css
   ========================================================== */

/* ---------- 0. 入口层令牌 ---------- */
:root {
  /* 幕布拉开 900ms + 接缝点亮 180ms = 总时长 1080ms（落在 0.8–1.2s 内） */
  --gate-seam: 180ms;
  --gate-slide: 900ms;
  --gate-ease: cubic-bezier(.76, 0, .24, 1);   /* 强 ease-in-out，克制、有分量 */
  --gate-intro: 700ms;                          /* 入口页自身内容的入场 */
  --gate-bg: #F7F3EA;                           /* 与 --bg 一致，接缝不露色差 */
}

/* ---------- 1. 容器 ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: grid;
  grid-template-columns: 1fr 1fr;   /* 左右各 50% */
  pointer-events: auto;
  /* 用 100dvh 兼容移动端浏览器工具栏；不支持时回退 100% */
  height: 100%;
}
@supports (height: 100dvh) { .gate { height: 100dvh; } }

/* JS 已接管标记；未标记时 3s 后自动失效（防 JS 挂掉把用户锁在入口页） */
.gate:not(.is-ready) { animation: jr-gate-failsafe 0s 3s forwards; }
@keyframes jr-gate-failsafe {
  to { visibility: hidden; opacity: 0; pointer-events: none; }
}

/* 本次会话已播过 / 已跳过：直接不渲染，避免闪一下 */
.gate.is-off { display: none; }

/* ---------- 2. 左右幕布 ---------- */
.gate__half {
  position: relative;
  overflow: hidden;
  background-color: var(--gate-bg);
  background-image:
    linear-gradient(rgba(247,243,234,.70), rgba(247,243,234,.70)),
    url("/assets/brand/gate-jr-h2.webp");
  background-size: 100% 100%, 200% 100%;
  background-repeat: no-repeat;
  will-change: transform;
  transition: transform var(--gate-slide) var(--gate-ease);
}
/* 幕布上的品牌氛围：网格 + 径向光晕 + 噪点（全部纯 CSS，零请求） */
.gate__half::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(28,26,23,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28,26,23,.04) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 90% 80% at var(--gx, 50%) 50%, #000 30%, transparent 100%);
          mask-image: radial-gradient(ellipse 90% 80% at var(--gx, 50%) 50%, #000 30%, transparent 100%);
}
.gate__half::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20width='140'%20height='140'%3E%3Cfilter%20id='g'%3E%3CfeTurbulence%20type='fractalNoise'%20baseFrequency='0.8'%20numOctaves='3'%20stitchTiles='stitch'/%3E%3CfeColorMatrix%20type='saturate'%20values='0'/%3E%3C/filter%3E%3Crect%20width='140'%20height='140'%20filter='url(%23g)'%20opacity='0.55'/%3E%3C/svg%3E");
  background-size: 140px 140px;
  opacity: .05;
  mix-blend-mode: overlay;
}
.gate__half--l { --gx: 100%; background-position: 0 0, left center; }
.gate__half--r { --gx: 0%; background-position: 0 0, right center; }
.gate__half--l::before {
  background-image:
    linear-gradient(rgba(28,26,23,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28,26,23,.04) 1px, transparent 1px),
    radial-gradient(70% 80% at 92% 50%, rgba(180,83,42,.16), transparent 70%);
}
.gate__half--r::before {
  background-image:
    linear-gradient(rgba(28,26,23,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28,26,23,.04) 1px, transparent 1px),
    radial-gradient(70% 80% at 8% 50%, rgba(47,93,80,.16), transparent 70%);
}

/* 拉开：左右各让出 100.5%（多半个百分点，彻底吃掉接缝处的亚像素缝） */
.gate.is-opening .gate__half--l { transform: translate3d(-100.5%, 0, 0); }
.gate.is-opening .gate__half--r { transform: translate3d(100.5%, 0, 0); }

/* 动画彻底结束后摘掉，释放合成层并让下层可交互 */
.gate.is-done { visibility: hidden; pointer-events: none; }

/* ---------- 3. 中央接缝光带 ----------
   拉开前先点亮 180ms，制造"门缝透光"的预告，是这段动效高级感的关键 */
.gate__seam {
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 1px;
  transform: translateX(-.5px);
  background: linear-gradient(180deg,
    transparent 0%,
    rgba(180,83,42,.35) 30%,
    rgba(180,83,42,.55) 50%,
    rgba(47,93,80,.35) 70%,
    transparent 100%);
  opacity: .25;
  transition: opacity var(--gate-seam) var(--e-io), width var(--gate-seam) var(--e-io);
  z-index: 3;
}
.gate.is-opening .gate__seam {
  opacity: 1;
  width: 2px;
  box-shadow: 0 0 26px 4px rgba(180,83,42,.42);
}

/* ---------- 4. 中央内容 ---------- */
.gate__center {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 24px;
  transition: opacity 320ms var(--e-out), transform 320ms var(--e-out);
}
/* 拉开瞬间：内容轻微放大并淡出，避免"硬切" */
.gate.is-opening .gate__center {
  opacity: 0;
  transform: scale(1.06);
  pointer-events: none;
}

.gate__logo {
  display: flex; align-items: center; gap: 14px;
  font-weight: 900; font-size: clamp(26px, 4vw, 38px); letter-spacing: .02em;
  margin-bottom: 10px;
}
.gate__logo svg { display: block; width: 56px; height: 56px; }
.gate__logo svg path { fill: url(#jrGrad); }
.gate__sub {
  font-size: 11.5px; font-weight: 600; letter-spacing: .34em;
  color: var(--muted); margin-bottom: 26px;
}
.gate__line {
  font-size: clamp(15px, 1.6vw, 18px);
  color: var(--text-dim);
  max-width: 30ch;
  line-height: 1.9;
  margin-bottom: 34px;
}

/* ---------- 5. 按钮 ---------- */
.gate__actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: center; }
/* 主按钮沿用品牌 .btn，只补一个"呼吸光环"，提示可点击 */
.gate__enter { position: relative; }
.gate__enter::before {
  content: "";
  position: absolute; inset: -3px;
  border-radius: 13px;
  border: 1px solid rgba(180, 83, 42,.45);
  opacity: 0;
  transition: opacity var(--t-base) var(--e-out);
  pointer-events: none;
}
.gate.is-armed .gate__enter::before { animation: jr-halo 2.4s var(--e-io) infinite; }
@keyframes jr-halo {
  0%, 100% { opacity: .15; transform: scale(1); }
  50%      { opacity: .55; transform: scale(1.04); }
}
.gate__enter:hover::before { animation: none; opacity: 0; }

/* 跳过：低调的文字链，不做成按钮，避免和主 CTA 抢注意力 */
.gate__skip {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: 13px; color: var(--muted);
  padding: 10px 6px; text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: rgba(255,255,255,.18);
  transition: color var(--t-fast) var(--e-out);
}
.gate__skip:hover { color: var(--text); }

/* ---------- 6. 入口页内容入场（intro） ----------
   逐项上浮，错峰 90ms；只有 .is-ready 之后才播，避免闪现 */
.gate.is-ready .gate__logo,
.gate.is-ready .gate__sub,
.gate.is-ready .gate__line,
.gate.is-ready .gate__actions {
  animation: jr-rise var(--gate-intro) var(--e-out) backwards;
}
.gate.is-ready .gate__logo    { animation-delay: 60ms; }
.gate.is-ready .gate__sub     { animation-delay: 150ms; }
.gate.is-ready .gate__line    { animation-delay: 240ms; }
.gate.is-ready .gate__actions { animation-delay: 330ms; }
@keyframes jr-rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- 7. 下层内容的"落定" ----------
   只动 transform，不触发重排；动画结束立刻摘掉，避免长期占合成层 */
.site-shell { transform-origin: 50% 45%; }
.site-shell.is-settling {
  animation: jr-settle 1000ms var(--e-out) backwards;
  will-change: transform;
}
@keyframes jr-settle {
  from { transform: scale(1.025); }
  to   { transform: scale(1); }
}

/* ---------- 8. 降级 ---------- */

/* 8.1 减弱动效：不做分屏位移，改为整层淡出 */
@media (prefers-reduced-motion: reduce) {
  .gate { transition: opacity 400ms linear; }
  .gate__half { transition: none; }
  .gate.is-opening { opacity: 0; }
  .gate.is-opening .gate__half--l,
  .gate.is-opening .gate__half--r { transform: none; }
  .gate.is-opening .gate__center { transform: none; transition: opacity 400ms linear; }
  .gate.is-ready .gate__logo,
  .gate.is-ready .gate__sub,
  .gate.is-ready .gate__line,
  .gate.is-ready .gate__actions { animation: none; }
  .gate.is-armed .gate__enter::before { animation: none; opacity: .3; }
  .gate__seam { transition: none; }
  .gate.is-opening .gate__seam { opacity: .25; width: 1px; box-shadow: none; }
  .site-shell.is-settling { animation: none; }
}

/* 8.2 移动端：接缝更窄、按钮铺满、字号收紧 */
@media (max-width: 768px) {
  .gate__line { margin-bottom: 26px; font-size: 15px; }
  .gate__actions { flex-direction: column; gap: 6px; width: 100%; max-width: 280px; }
  .gate__enter { width: 100%; }
  .gate__skip { padding: 6px; }
  .gate__sub { letter-spacing: .26em; margin-bottom: 20px; }
  /* 移动端不做 1.025 缩放，低端机合成 100vh 大层会掉帧 */
  .site-shell.is-settling { animation: none; }
}

/* 8.3 打印 / 无 JS：入口层永不出现 */
@media print { .gate { display: none !important; } }
.no-js .gate { display: none !important; }

/* ---------- 9. 入口层 · 三间工作室对照（2026-09-08 新增） ---------- */
.gate__rooms {
  display: grid; grid-template-columns: 74px 1fr 14px; align-items: center;
  column-gap: 16px; width: min(400px, 84vw);
  margin: 26px auto 0; text-align: left;
}
.gate__rooms > * { padding: 10px 0; border-top: 1px solid rgba(28,26,23,.18); }
.gate__rooms .gr-k {
  font-size: 10.5px; letter-spacing: .22em; color: var(--muted);
  font-weight: 700; text-transform: uppercase;
}
.gate__rooms .gr-t { font-family: var(--serif); font-size: 17px; font-weight: 900; letter-spacing: .015em; color: var(--text); }
.gate__rooms .gr-t em { font-style: normal; }
.gate__rooms .gr-i { width: 8px; height: 8px; border-radius: 50%; justify-self: end; }
.gate__rooms .r1 .gr-t em { color: var(--accent); }
.gate__rooms .r1 .gr-i { background: var(--accent); }
.gate__rooms .r2 .gr-t em { color: var(--accent-t); }
.gate__rooms .r2 .gr-i { background: var(--accent-t); }
.gate__rooms .r3 .gr-t em { color: var(--accent-2); }
.gate__rooms .r3 .gr-i { background: var(--accent-2); }
.gate__rooms .gr-note { grid-column: 1 / -1; border-top: 0; padding-top: 12px; font-size: 12.5px; color: var(--muted); letter-spacing: .02em; }
