/* ============================================================
 * brand-intro.css — Laventis 開場揭示動畫
 * ------------------------------------------------------------
 * 來源：用戶上傳的 index.html（Atlas 入口頁設計）
 * 落地：2026-04-29 移植到 home.html
 * 範圍：純 intro overlay（noise / bg-lift / intro-stage / progress / scan
 *       / soft-return / cookie-consent / skip）+ header.settled 增量
 * 不含：#header / #logo-slot / #nav / body / html 主樣式（home.html 已有）
 * 協同：home.html 必須有 <header id="header"><div id="logo-slot">...</div>
 *       <nav id="nav">...</nav></header> 結構，FLIP 才能對位
 * 觸發：JS 控制 body.intro-active（鎖滾動）/ body.is-home（揭示完成）
 * ============================================================ */

/* ── intro 專屬 token（不與 home.html 衝突的部分）── */
:root {
  --lav-line:      rgba(183,194,210,0.16);
  --lav-line-hi:   rgba(183,194,210,0.42);
  --lav-gold:      #d4a84f;
  --lav-gold-dim:  rgba(212,168,79,0.40);
  --lav-muted:     #b7c2d2;
  --lav-black:     #060e1a;
  --lav-decl:      #edf1f7;
  --lav-glow-w:    rgba(220,232,255,0.82);
  --lav-glow-b:    rgba(74,111,165,0.18);
  --lav-header-logo: #b7c2d2;
  --lav-white-lo:  #8a96a8;
  --lav-ease-out:  cubic-bezier(0.16, 1, 0.3, 1);
  --lav-ease-in:   cubic-bezier(0.4,  0, 0.8, 1);
  --lav-ease-flip: cubic-bezier(0.22, 1, 0.36, 1);
  --lav-return-dur: 340ms;
}

/* ── intro 啟動時鎖滾動（JS 控制） ── */
body.intro-active {
  overflow: hidden;
  background: var(--lav-black);
}

/* ════════════════════════════════ NOISE ════════════════════════════════ */
#noise {
  position: fixed; inset: 0; z-index: 0;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.016) 0, rgba(255,255,255,0.01) 25%, transparent 25%, transparent 50%, rgba(255,255,255,0.01) 50%, rgba(255,255,255,0.016) 75%, transparent 75%, transparent 100%);
  background-size: 14px 14px;
  opacity: 0.03;
  pointer-events: none;
}

/* ════════════════════════════════
 * 全域背景亮起層 — Atlas 真實 body 背景
 * ════════════════════════════════ */
#bg-lift {
  position: fixed; inset: 0; z-index: 1;
  background:
    radial-gradient(circle at top right, rgba(74,111,165,0.24), transparent 30%),
    radial-gradient(circle at left 80%,  rgba(212,168,79,0.08),  transparent 25%),
    linear-gradient(180deg, var(--bg-dark, #09162c) 0%, var(--bg, #0b1f3b) 35%, var(--bg-mid, #0d2343) 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--lav-return-dur) var(--lav-ease-flip);
}
body.is-home #bg-lift { opacity: 1; }

/* ════════════════════════════════
 * #header.settled — intro 完成 FLIP 後 header 邊線亮一下再落回
 * （home.html 的 #header 主樣式不被覆蓋，這只是增量動畫）
 * ════════════════════════════════ */
#header.settled {
  animation: headerSettle var(--lav-return-dur) var(--lav-ease-flip) forwards;
}
@keyframes headerSettle {
  0%   { border-color: rgba(120,140,170,0);    box-shadow: none; }
  58%  { border-color: var(--lav-line-hi);     box-shadow: 0 1px 10px rgba(183,194,210,0.2); }
  100% { border-color: var(--lav-line);        box-shadow: 0 0 0 rgba(0,0,0,0); }
}

/* nav fade-in（home.html 的 #nav 主樣式不被覆蓋）*/
#nav { opacity: 0; transition: opacity var(--lav-return-dur) var(--lav-ease-flip); }
#nav.show { opacity: 1; }

/* ════════════════════════════════
 * INTRO STAGE
 * ════════════════════════════════ */
#intro-stage {
  position: fixed; inset: 0; z-index: 50;
  pointer-events: auto;
  background: var(--lav-black);
  transition: opacity var(--lav-return-dur) var(--lav-ease-flip), visibility 0ms linear var(--lav-return-dur);
}
body.is-home #intro-stage {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ── Laventis 中央宣言區 ── */
#laventis-zone {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transform: translateY(-4%);
  pointer-events: none;
  transition: transform var(--lav-return-dur) var(--lav-ease-flip), opacity var(--lav-return-dur) var(--lav-ease-flip);
}
body.is-home #laventis-zone {
  transform: translate(calc(-50vw + 180px), calc(-50vh + 34px)) scale(0.26);
  opacity: 0.04;
}

#brand-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  will-change: opacity, transform;
}

/* 2026-04-29 字級重新平衡：原 6rem / 2.4rem 落差 2.5 倍視覺撐爆
   調整為 5rem / 2.6rem (≈1.9:1)、字距收斂讓兩者寬度更接近、視覺更穩 */
#laventis {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-style: normal;
  font-size: clamp(1.8rem, 7vw, 5rem);
  letter-spacing: clamp(0.18em, 1.6vw, 0.38em);
  padding-right: clamp(0.18em, 1.6vw, 0.38em);
  color: var(--lav-decl);
  user-select: none;
  white-space: nowrap;
  max-width: 92vw;
  overflow: visible;
  opacity: 0.28;
  will-change: opacity, color;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transform: translateZ(0);
  text-shadow:
    0 0 1px var(--lav-glow-w),
    0 0 28px var(--lav-glow-b),
    0 0 120px rgba(74,111,165,0.12);
}

#strategic {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: clamp(0.95rem, 3.5vw, 2.6rem);
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(212,168,79,0.72);
  padding-left: clamp(0.14em, 0.6vw, 0.26em);
  margin-top: 0.32em;
  opacity: 0;
  will-change: opacity;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  transform: translateZ(0);
  white-space: nowrap;
}

/* 校準線 */
#brand-rule {
  position: relative;
  width: 0; height: 0.5px;
  background: var(--lav-line);
  margin-top: 1.5em;
  will-change: width, opacity;
  transition: width 2000ms var(--lav-ease-out) 200ms;
}
#brand-rule::before, #brand-rule::after {
  content: '';
  position: absolute; top: -2px;
  width: 1px; height: 5px;
  background: var(--lav-muted);
  opacity: 0;
  transition: opacity 400ms ease 1800ms;
}
#brand-rule::before { left: 0; }
#brand-rule::after  { right: 0; }
#brand-rule.expand  { width: clamp(44px, 9vw, 80px); }
#brand-rule.expand::before,
#brand-rule.expand::after { opacity: 0.5; }

/* Tagline */
#tagline {
  font-family: 'DM Mono', monospace;
  font-weight: 300;
  font-size: clamp(0.9rem, 1.5vw, 1.08rem);
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-transform: uppercase;
  color: var(--lav-gold);
  margin-top: 1.3em;
  opacity: 0;
  transform: translateY(4px);
  will-change: opacity, transform;
  transition: opacity 1400ms ease 700ms, transform 1400ms var(--lav-ease-out) 700ms;
  max-width: min(92vw, 880px);
  text-wrap: balance;
}
#tagline.show { opacity: 1; transform: translateY(0); }

/* ── One 觸發器區 ── */
#one-zone {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  transform: translateY(20%);
  opacity: 0;
  will-change: opacity;
}

#one-container {
  position: relative;
  display: flex; align-items: center; justify-content: center;
}

#one {
  font-family: 'Raleway', sans-serif;
  font-weight: 100;
  font-size: clamp(1.4rem, 4.8vw, 3.4rem);
  letter-spacing: 0.38em;
  padding-right: 0.38em;
  color: var(--lav-white-lo);
  user-select: none;
  will-change: opacity, transform;
  text-shadow: 0 0 1px rgba(168,176,190,0.4);
}

#line-left, #line-right {
  position: absolute; top: 50%;
  height: 0.5px; width: 0;
  will-change: width;
  transition: width 1100ms var(--lav-ease-out);
}
#line-left {
  right: calc(100% + 1em);
  background: linear-gradient(270deg, rgba(192,192,188,0.24) 0%, transparent 100%);
}
#line-right {
  left: calc(100% + 0.4em);
  background: linear-gradient(90deg, rgba(192,192,188,0.24) 0%, transparent 100%);
}
#one-container.lines #line-left,
#one-container.lines #line-right { width: clamp(16px, 4vw, 44px); }
#line-right::after {
  content: ''; position: absolute; right: 0; top: -2px;
  width: 0.5px; height: 4px;
  background: rgba(192,192,188,0.20);
  opacity: 0; transition: opacity 260ms ease 960ms;
}
#one-container.lines #line-right::after { opacity: 1; }

#one-dot {
  position: absolute;
  width: 2px; height: 2px; border-radius: 50%;
  background: var(--lav-white-lo);
  opacity: 0; will-change: opacity;
}
#lock-pulse {
  position: absolute;
  width: 1px; height: 1px; border-radius: 50%;
  border: 0.5px solid rgba(192,192,188,0);
  opacity: 0; will-change: transform, opacity;
}

/* 副標 — 精神語（中文版適配 2026-04-29）
   - 移除 text-transform:uppercase（對中文無效）
   - 字體改為中文友善 stack（DM Mono 對中文 fallback 風格不一致）
   - 字級稍放大：中文較英文需要更大視覺重量
   - 字距 0.18em：中文呼吸感、不致散開 */
#sub {
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', 'Helvetica Neue', sans-serif;
  font-weight: 300;
  font-size: clamp(1rem, 1.7vw, 1.18rem);
  letter-spacing: 0.18em;
  line-height: 1.55;
  color: var(--lav-gold);
  margin-top: 1.6em;
  opacity: 0;
  transform: translateY(5px);
  will-change: opacity, transform;
  transition: opacity 900ms ease, transform 900ms var(--lav-ease-out);
}
#sub.show { opacity: 1; transform: translateY(0); }

/* ════════════════════════════════
 * 進度線 / 掃描光
 * ════════════════════════════════ */
#progress-track {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 1px; background: rgba(140,160,175,0.04);
  z-index: 10;
}
#progress-fill {
  height: 100%; width: 0%;
  background: rgba(183,194,210,0.28);
  will-change: width;
}
#scan {
  position: fixed; top: 50%; left: -100%;
  width: 100%; height: 1px;
  background: linear-gradient(90deg,
    transparent 15%, rgba(240,240,238,0.52) 50%, transparent 85%);
  z-index: 60; opacity: 0;
  will-change: left, opacity;
}

/* ════════════════════════════════ Soft Return Layer ════════════════════════════════ */
#soft-return-layer {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
}
#soft-return-layer::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 28% 35%, rgba(74,111,165,0.24), transparent 52%),
    radial-gradient(circle at 78% 62%, rgba(212,168,79,0.12), transparent 48%),
    linear-gradient(180deg, rgba(9,22,44,0.18) 0%, rgba(11,31,59,0.28) 100%);
  opacity: 0;
}
#soft-return-sweep {
  position: absolute;
  top: 0; bottom: 0;
  width: 46%;
  left: -52%;
  background: linear-gradient(100deg, rgba(212,168,79,0), rgba(212,168,79,0.24) 48%, rgba(212,168,79,0));
  filter: blur(0.4px);
}
#soft-return-mark {
  position: absolute;
  left: clamp(1rem, 4vw, 2.4rem);
  top: calc(64px + clamp(0.8rem, 2vw, 1.2rem));
  font-family: 'DM Mono', monospace;
  font-size: clamp(0.82rem, 1.4vw, 1rem);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(231,215,177,0.96);
  opacity: 0;
  transform: translateY(6px);
  text-shadow: 0 0 12px rgba(212,168,79,0.24);
}
#soft-return-layer.play {
  visibility: visible;
  animation: softReturnFrame 620ms var(--lav-ease-flip) forwards;
}
#soft-return-layer.play::before {
  animation: softReturnWash 620ms var(--lav-ease-flip) forwards;
}
#soft-return-layer.play #soft-return-sweep {
  animation: softReturnSweep 540ms cubic-bezier(0.19, 1, 0.22, 1) forwards;
}
#soft-return-layer.play #soft-return-mark {
  animation: softReturnMark 620ms var(--lav-ease-flip) forwards;
}
@keyframes softReturnFrame {
  0% { opacity: 0; }
  12% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes softReturnWash {
  0% { opacity: 0; }
  18% { opacity: 1; }
  100% { opacity: 0; }
}
@keyframes softReturnSweep {
  0% { left: -52%; opacity: 0; }
  20% { opacity: 1; }
  100% { left: 112%; opacity: 0; }
}
@keyframes softReturnMark {
  0% { opacity: 0; transform: translateY(6px); }
  24% { opacity: 0.96; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-2px); }
}

/* intro 進行中強制隱藏 cookie banner（home.html 進站立即觸發 banner，會穿過 intro overlay） */
body.intro-active #cookie-consent { display: none !important; }

/* ════════════════════════════════ Cookie Consent ════════════════════════════════
 * 注意：home.html 已有自己的 cookie consent CSS（line 448-512）與 JS（line 678-699）
 * 以下樣式作為 fallback 保留（給未來不依賴 home.html 內建 cookie 的頁面）
 * ════════════════════════════════ */
.cookie-consent {
  position: fixed;
  right: clamp(0.9rem, 3vw, 1.6rem);
  bottom: clamp(0.9rem, 3vw, 1.4rem);
  z-index: 130;
  width: min(430px, calc(100vw - 1.8rem));
  border: 1px solid rgba(183,194,210,0.24);
  border-radius: 16px;
  background:
    linear-gradient(155deg, rgba(255,255,255,0.08), rgba(255,255,255,0.018) 58%, rgba(255,255,255,0.01)),
    radial-gradient(circle at top right, rgba(74,111,165,0.18), transparent 48%),
    linear-gradient(180deg, rgba(9,22,44,0.92), rgba(11,31,59,0.92));
  box-shadow: 0 18px 42px rgba(3,10,20,0.44);
  padding: 0.95rem 1rem 1rem;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 240ms ease, transform 240ms ease;
  color: var(--text, #edf1f7);
  backdrop-filter: blur(10px);
}
.cookie-consent.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.cookie-kicker {
  font-family: 'DM Mono', monospace;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--lav-gold);
}
.cookie-title {
  margin-top: 0.35rem;
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.08rem, 2vw, 1.34rem);
  line-height: 1.26;
}
.cookie-copy {
  margin-top: 0.42rem;
  color: rgba(183,194,210,0.92);
  font-size: clamp(0.9rem, 1.2vw, 1rem);
  line-height: 1.6;
}
.cookie-actions {
  margin-top: 0.72rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}
.cookie-btn {
  min-height: 44px;
  border-radius: 999px;
  padding: 0 0.95rem;
  border: 1px solid transparent;
  background: rgba(183,194,210,0.18);
  color: var(--text, #edf1f7);
  font-family: 'DM Mono', monospace;
  font-size: 0.64rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.cookie-btn-primary {
  background: var(--lav-gold);
  color: #0b1624;
}
.cookie-btn-link {
  background: transparent;
  border-color: rgba(183,194,210,0.36);
  color: var(--lav-muted);
}
.cookie-manage {
  margin-top: 0.75rem;
  border-top: 1px solid rgba(183,194,210,0.16);
  padding-top: 0.72rem;
}
.cookie-toggle {
  display: flex;
  align-items: flex-start;
  gap: 0.58rem;
  margin-bottom: 0.62rem;
  color: rgba(183,194,210,0.92);
  font-size: 0.92rem;
  line-height: 1.5;
}
.cookie-toggle input[type='checkbox'] {
  margin-top: 0.2rem;
  accent-color: var(--lav-gold);
}
.cookie-toggle small {
  display: block;
  color: rgba(183,194,210,0.72);
  font-size: 0.84rem;
}
.cookie-manage-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 768px) {
  .cookie-consent {
    right: 0.6rem;
    left: 0.6rem;
    width: auto;
    bottom: 0.6rem;
  }
  .cookie-copy { font-size: 0.95rem; }
}

/* ── Skip ── */
#skip {
  position: fixed; bottom: 2rem; right: 2rem; z-index: 200;
  font-family: 'Raleway', sans-serif;
  font-weight: 200; font-size: 0.50rem;
  letter-spacing: 0.36em; text-transform: uppercase;
  color: rgba(192,192,188,0.20);
  background: none; border: none; cursor: pointer;
  opacity: 0; pointer-events: none;
  transition: opacity 400ms ease, color 300ms ease;
  padding: 0.6rem;
}
#skip.show { opacity: 1; pointer-events: auto; }
#skip:hover { color: rgba(192,192,188,0.55); }

@media (max-width: 480px) {
  #skip { right: 0.8rem; bottom: 1rem; font-size: 0.44rem; letter-spacing: 0.26em; }
}

/* a11y · reduced-motion */
@media (prefers-reduced-motion: reduce) {
  #intro-stage,
  #laventis-zone,
  #bg-lift,
  #brand-rule,
  #tagline,
  #sub,
  #scan,
  #progress-fill,
  #header.settled,
  #nav,
  #soft-return-layer,
  #soft-return-sweep,
  #soft-return-mark,
  .cookie-consent {
    animation: none !important;
    transition: none !important;
  }
}
