/* ============================================================
   site.css — live 咔嗒Lab site (Direction A, responsive)
   Reuses utilities from theme.css (.nm-*, .btn, .chip, .eyebrow,
   .arrow-dot, .theme-toggle, .pulse, .glyph). Defines .ka tokens.
   ============================================================ */

/* ---- tokens (mirror of theme.css, applied to :root for live pages) ---- */
:root[data-theme="light"] {
  --bg:#e4e7ee; --bg-sink:#dce0e9; --bg-rise:#eef1f7;
  --ink:#262b36; --ink-soft:#545c6b; --ink-faint:#8b93a4;
  --hair:rgba(38,43,54,0.08);
  --d-sh:rgba(163,174,196,0.62); --l-sh:rgba(255,255,255,0.95);
  --accent-ink:#fff;
  --accent-glow:color-mix(in oklch, var(--accent, #2f6df0) 22%, transparent);
  --accent-tint:color-mix(in oklch, var(--accent, #2f6df0) 12%, var(--bg));
}
:root[data-theme="dark"] {
  --bg:#21242c; --bg-sink:#1c1f26; --bg-rise:#272b34;
  --ink:#e7eaf1; --ink-soft:#aab2c2; --ink-faint:#6f7888;
  --hair:rgba(255,255,255,0.07);
  --d-sh:rgba(0,0,0,0.55); --l-sh:rgba(255,255,255,0.045);
  --accent-ink:#0b1220;
  --accent-glow:color-mix(in oklch, var(--accent, #2f6df0) 36%, transparent);
  --accent-tint:color-mix(in oklch, var(--accent, #2f6df0) 16%, var(--bg));
}
:root { --accent: #2f6df0; --soft: 1; }

html, body { margin: 0; padding: 0; }
body.ka-body {
  background: var(--bg); color: var(--ink);
  font-family: var(--font-sans); -webkit-font-smoothing: antialiased;
  transition: background .45s ease, color .45s ease;
  min-height: 100vh;
}
/* attribute-scoped fallback so the page is themed even before React adds .ka-body */
:root[data-theme="light"] body, :root[data-theme="dark"] body { background: var(--bg); color: var(--ink); }
.ka { position: relative; color: var(--ink); }
.ka *, .ka *::before, .ka *::after { box-sizing: border-box; }
.ka a { color: inherit; text-decoration: none; }
.ka a.txtlink { color: var(--accent); }

.kc { max-width: 1200px; margin: 0 auto; padding: 0 40px; }

/* logo light/dark swap for the live site (tokens live on :root) */
:root[data-theme="light"] .ka .logo-dark,
:root[data-theme="dark"]  .ka .logo-light { display: block; }
:root[data-theme="light"] .ka .logo-light,
:root[data-theme="dark"]  .ka .logo-dark { display: none; }
.muted { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.txtlink { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; color: var(--accent); cursor: pointer; }
.txtlink svg { transition: transform .25s; }
.txtlink:hover svg { transform: translateX(4px); }
.sec-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.sec-title { font-family: var(--font-display); font-weight: 600; letter-spacing: -.01em; font-size: 30px; margin: 0; color: var(--ink); }

/* ============================================================
   NAV — sticky pill, bigger logo
   ============================================================ */
.ka-navwrap { position: sticky; top: 0; z-index: 50; padding: 18px 0 6px; }
.ka-navwrap::before { content:""; position:absolute; inset:0; background:var(--bg); -webkit-mask-image:linear-gradient(var(--bg),transparent); mask-image:linear-gradient(#000,transparent); opacity:.85; }
.ka-nav {
  position: relative; display: flex; align-items: center; gap: 26px;
  padding: 12px 12px 12px 26px; border-radius: 999px;
}
.ka-nav .links { display: flex; align-items: center; gap: 4px; margin-left: 14px; }
.ka-nav .links a {
  font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  padding: 9px 16px; border-radius: 999px; transition: color .2s, box-shadow .3s;
}
.ka-nav .links a:hover { color: var(--ink); }
.ka-nav .links a.on { color: var(--ink); }
.ka-nav .spacer { flex: 1; }
.ka-nav .right { display: flex; align-items: center; gap: 12px; }
.ka-menu-btn { display: none; }

/* ============================================================
   ANIMATED BACKDROP — soft drifting orbs + dot grid + particles
   ============================================================ */
.ka-stage { position: relative; }
.backdrop { position: absolute; inset: -10% -5% 0; overflow: hidden; pointer-events: none; z-index: 0; }
.backdrop .orb {
  position: absolute; border-radius: 50%; filter: blur(70px);
  will-change: transform; opacity: .55;
}
:root[data-theme="dark"] .backdrop .orb { opacity: .4; filter: blur(80px); }
.orb-1 { width: 520px; height: 520px; top: -120px; left: 8%;
  background: radial-gradient(circle at 50% 50%, var(--accent-glow), transparent 68%);
  animation: floatA 22s ease-in-out infinite alternate;
  transform: translate(calc(var(--mx,0) * 18px), calc(var(--my,0) * 14px)); }
.orb-2 { width: 460px; height: 460px; top: 40px; right: 4%;
  background: radial-gradient(circle at 50% 50%, color-mix(in oklch, var(--accent) 16%, transparent), transparent 70%);
  animation: floatB 26s ease-in-out infinite alternate;
  transform: translate(calc(var(--mx,0) * -22px), calc(var(--my,0) * 18px)); }
.orb-3 { width: 360px; height: 360px; bottom: -40px; left: 38%;
  background: radial-gradient(circle at 50% 50%, color-mix(in oklch, var(--ink) 7%, transparent), transparent 72%);
  animation: floatA 30s ease-in-out infinite alternate-reverse; }
.backdrop .grid {
  position: absolute; inset: 0;
  background-image: radial-gradient(var(--hair) 1px, transparent 1.4px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 30%, #000 30%, transparent 78%);
          mask-image: radial-gradient(120% 90% at 50% 30%, #000 30%, transparent 78%);
  animation: drift 24s linear infinite; opacity: .8;
}
.backdrop .pt {
  position: absolute; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); opacity: .0; box-shadow: 0 0 10px var(--accent-glow);
  animation: rise linear infinite;
}
@keyframes floatA { from { transform: translate(0,0) scale(1); } to { transform: translate(46px,-34px) scale(1.14); } }
@keyframes floatB { from { transform: translate(0,0) scale(1); } to { transform: translate(-40px,28px) scale(1.1); } }
@keyframes drift { to { background-position: 30px 30px; } }
@keyframes rise {
  0% { transform: translateY(40px); opacity: 0; }
  18% { opacity: .7; }
  82% { opacity: .5; }
  100% { transform: translateY(-220px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .backdrop .orb, .backdrop .grid, .backdrop .pt { animation: none; }
}

/* ============================================================
   HOME — hero / stats / events / modules
   ============================================================ */
.h-hero { position: relative; z-index: 1; text-align: center; padding: 96px 0 60px; }
.h-hero .eyebrow { display: inline-flex; gap: 10px; align-items: center; margin-bottom: 28px; }
.h-hero h1 {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(40px, 5.6vw, 72px);
  line-height: 1.05; letter-spacing: -.02em; margin: 0 auto 26px; max-width: 14em; color: var(--ink);
}
.h-hero h1 .ac { color: var(--accent); }
.h-hero p { font-size: clamp(16px,1.4vw,19px); line-height: 1.7; color: var(--ink-soft); max-width: 32em; margin: 0 auto 40px; }
.h-cta { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   HERO TITLE "咔嗒一下" — three click→connect animations (Tweak)
   ============================================================ */
.h-titlewrap { position: relative; display: inline-block; margin: 0 auto 26px; max-width: 100%; cursor: pointer; }
.h-titlewrap .h-title { margin: 0; max-width: none; }
.h-title { font-family: var(--font-display); font-weight: 600; font-size: clamp(46px, 6.2vw, 80px); line-height: 1.04; letter-spacing: -.02em; color: var(--ink); }
.h-title .ac { color: var(--accent); }

/* ---- A · 拼合 (two halves lock together — neumorphic press-stud) ---- */
.h-title.anim-snap { position: relative; display: inline-flex; align-items: center; }
.anim-snap .plate { display: inline-flex; align-items: center; background: var(--bg); position: relative; z-index: 1; padding: .16em .5em;
  box-shadow: calc(5px*var(--soft)) calc(5px*var(--soft)) calc(13px*var(--soft)) var(--d-sh), calc(-5px*var(--soft)) calc(-5px*var(--soft)) calc(13px*var(--soft)) var(--l-sh); }
.anim-snap .pl { border-radius: .32em .1em .1em .32em; padding-right: .56em; }
.anim-snap .pr { border-radius: .1em .32em .32em .1em; padding-left: .56em; }
.anim-snap .stud { position: absolute; left: 50%; top: 50%; width: .46em; height: .46em; border-radius: 50%; transform: translate(-50%,-50%); background: var(--bg); z-index: 3;
  box-shadow: calc(2px*var(--soft)) calc(2px*var(--soft)) calc(5px*var(--soft)) var(--d-sh), calc(-2px*var(--soft)) calc(-2px*var(--soft)) calc(5px*var(--soft)) var(--l-sh); }
.anim-snap .stud::after { content: ""; position: absolute; inset: 28%; border-radius: 50%; background: var(--accent); }
.anim-snap .stud::before { content: ""; position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--accent); transform: translate(-50%,-50%) scale(.4); opacity: 0; }
/* entrance only when .play is added on mount/replay */
.anim-snap.play .pl { animation: plateL .52s cubic-bezier(.3,.8,.3,1) .05s forwards; }
.anim-snap.play .pr { animation: plateR .52s cubic-bezier(.3,.8,.3,1) .05s forwards; }
.anim-snap.play .stud { animation: studPop .46s cubic-bezier(.2,.85,.25,1) .5s forwards; }
.anim-snap.play .stud::before { animation: snapRing .6s ease-out .52s; }
@keyframes plateL { 0% { transform: translateX(-50px); opacity: 0; } 72% { transform: translateX(4px); } 100% { transform: none; opacity: 1; } }
@keyframes plateR { 0% { transform: translateX(50px); opacity: 0; } 72% { transform: translateX(-4px); } 100% { transform: none; opacity: 1; } }
@keyframes studPop { 0% { transform: translate(-50%,-50%) scale(0); } 60% { transform: translate(-50%,-50%) scale(1.2); } 100% { transform: translate(-50%,-50%) scale(1); } }
@keyframes snapRing { 0% { transform: translate(-50%,-50%) scale(.4); opacity: .7; } 100% { transform: translate(-50%,-50%) scale(3.4); opacity: 0; } }

/* ---- B · 节点网络 (network bloom, loops) — text always visible ---- */
.anim-network { padding: 18px 30px; }
.anim-network .net-svg { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: .55; overflow: visible; }
.anim-network .net-lines line { stroke: var(--accent); stroke-width: 1.6; fill: none; stroke-dasharray: 420; stroke-dashoffset: 0; opacity: .7; }
.anim-network.play .net-lines line { animation: netDraw 3.8s ease-in-out infinite; }
.anim-network.play .net-lines line:nth-child(2) { animation-delay: .3s; }
.anim-network.play .net-lines line:nth-child(3) { animation-delay: .6s; }
.anim-network.play .net-lines line:nth-child(4) { animation-delay: .9s; }
.anim-network.play .net-lines line:nth-child(5) { animation-delay: .45s; }
.anim-network.play .net-lines line:nth-child(6) { animation-delay: .75s; }
.anim-network .net-nodes circle { fill: var(--accent); transform-box: fill-box; transform-origin: center; opacity: .7; }
.anim-network.play .net-nodes circle { animation: netNode 3.8s ease-in-out infinite; }
.anim-network.play .net-nodes circle:nth-child(2) { animation-delay: .3s; }
.anim-network.play .net-nodes circle:nth-child(3) { animation-delay: .55s; }
.anim-network.play .net-nodes circle:nth-child(4) { animation-delay: .85s; }
.anim-network.play .net-nodes circle:nth-child(5) { animation-delay: 1.1s; }
.anim-network .h-title { position: relative; z-index: 1; }
.anim-network.play .h-title { animation: fadeUp .7s ease .1s forwards; }
@keyframes netDraw { 0% { stroke-dashoffset: 420; opacity: 0; } 22% { opacity: .85; } 60% { stroke-dashoffset: 0; opacity: .85; } 86% { opacity: .4; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes netNode { 0%, 100% { opacity: .35; transform: scale(.7); } 50% { opacity: 1; transform: scale(1.25); } }
@keyframes fadeUp { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: none; } }

/* ---- C · 脉冲涟漪 (click ripple cascade) — chars always visible ---- */
.anim-ripple { padding: 26px 34px; }
.anim-ripple .h-title { position: relative; z-index: 1; }
.anim-ripple .h-title i { display: inline-block; font-style: normal; }
.anim-ripple.play .h-title i { animation: charPop .52s cubic-bezier(.2,.85,.25,1) forwards; }
.anim-ripple .ripple { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; border: 2px solid var(--accent); transform: scale(.2); opacity: 0; pointer-events: none; }
.anim-ripple.play .ripple { animation: rip 2.6s ease-out .5s infinite; }
.anim-ripple.play .ripple.r2 { animation-delay: 1.8s; }
.anim-ripple .rdot { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .22; }
.anim-ripple.play .rdot { animation: dotLight 2.6s ease-in-out infinite; }
.anim-ripple .rdot.d1 { left: 6%; top: 24%; animation-delay: .7s; }
.anim-ripple .rdot.d2 { right: 8%; top: 16%; animation-delay: 1.0s; }
.anim-ripple .rdot.d3 { left: 12%; bottom: 18%; animation-delay: 1.3s; }
.anim-ripple .rdot.d4 { right: 13%; bottom: 12%; animation-delay: 1.6s; }
@keyframes charPop { 0% { opacity: 0; transform: translateY(10px) scale(.82); } 60% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 1; transform: none; } }
@keyframes rip { 0% { transform: scale(.2); opacity: .6; } 100% { transform: scale(7); opacity: 0; } }
@keyframes dotLight { 0%, 100% { opacity: .2; transform: scale(.8); } 45% { opacity: 1; transform: scale(1.35); } }

@media (prefers-reduced-motion: reduce) {
  .anim-snap.play .pl, .anim-snap.play .pr, .anim-snap.play .stud { animation: none; }
  .anim-snap .stud::before { display: none; }
  .anim-network.play .net-lines line, .anim-network.play .net-nodes circle, .anim-network.play .h-title { animation: none; }
  .anim-ripple.play .h-title i, .anim-ripple.play .ripple, .anim-ripple.play .rdot { animation: none; }
}

/* ---- hero intro: three design variants (Tweak: 简介样式) ---- */
.h-intro { margin: 0 auto 42px; }
.h-intro .click, .h-intro .hl { font-weight: 600; }

/* A · 关键词高亮 — refined single paragraph */
.intro-a { max-width: 34em; font-size: clamp(16px,1.45vw,19px); line-height: 1.85; color: var(--ink-soft); text-wrap: pretty; }
.intro-a .hl { color: var(--ink); }
.intro-a .click { color: var(--accent);
  background: linear-gradient(var(--accent), var(--accent)) left 92%/100% 2px no-repeat;
  padding-bottom: 1px; }

/* B · 宣言式 — two-tier display typography */
.intro-b { max-width: 28em; }
.intro-b .lead { font-family: var(--font-display); font-size: clamp(21px,2.3vw,29px); line-height: 1.42; font-weight: 600; letter-spacing: -.015em; color: var(--ink); margin: 0 0 18px; text-wrap: balance; }
.intro-b .lead .hl { color: var(--accent); }
.intro-b .sub { position: relative; font-size: clamp(14px,1.25vw,16.5px); line-height: 1.8; color: var(--ink-soft); margin: 0; padding-top: 18px; text-wrap: pretty; }
.intro-b .sub::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 44px; height: 2px; border-radius: 2px; background: var(--accent); opacity: .6; }
.intro-b .sub .click { color: var(--accent); }

/* C · 声波 — soundwave / click motif */
.intro-c { max-width: 34em; font-size: clamp(16px,1.45vw,19px); line-height: 1.9; color: var(--ink-soft); text-wrap: pretty; }
.intro-c .click { color: var(--accent); display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.clickwave { display: inline-flex; align-items: center; gap: 3px; height: 1.05em; vertical-align: -0.18em; }
.clickwave i { width: 3px; height: 35%; border-radius: 2px; background: var(--accent); animation: cw 1.05s ease-in-out infinite; }
.clickwave i:nth-child(1) { animation-delay: 0s; }
.clickwave i:nth-child(2) { animation-delay: .14s; }
.clickwave i:nth-child(3) { animation-delay: .28s; }
.clickwave i:nth-child(4) { animation-delay: .42s; }
.clickwave i:nth-child(5) { animation-delay: .56s; }
@keyframes cw { 0%, 100% { height: 28%; opacity: .55; } 50% { height: 100%; opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .clickwave i { animation: none; height: 64%; } }

.h-stats { position: relative; z-index: 1; display: flex; max-width: 800px; margin: 0 auto; border-radius: 22px; padding: 10px; }
.h-stat { flex: 1; text-align: center; padding: 20px 8px; }
.h-stat .v { font-family: var(--font-display); font-size: clamp(24px,3vw,32px); font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.h-stat .l { font-size: 13px; color: var(--ink-faint); margin-top: 4px; }
.h-stat + .h-stat { border-left: 1px solid var(--hair); }

.h-section { padding: 92px 0 0; position: relative; z-index: 1; }

.ev-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px; }
.ev-card { border-radius: 24px; padding: 30px 30px 26px; cursor: pointer; display: flex; flex-direction: column; min-height: 244px; position: relative; overflow: hidden; }
/* faint accent hairline that wipes in along the top edge on hover */
.ev-card::after { content: ""; position: absolute; top: 0; left: 30px; right: 30px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), transparent); transform: scaleX(0); transform-origin: left; opacity: .8;
  transition: transform .45s cubic-bezier(.2,.7,.3,1); }
.ev-card:hover::after { transform: scaleX(1); }
.ev-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.ev-date { font-family: var(--font-mono); font-size: 23px; font-weight: 500; color: var(--ink); letter-spacing: -.02em; line-height: 1; }
.ev-date span { font-size: 12px; color: var(--ink-faint); margin-left: 9px; letter-spacing: 0; }
.ev-tag { font-family: var(--font-mono); font-size: 12px; color: var(--accent); letter-spacing: .03em; display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.ev-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ev-card h3 { font-size: 19.5px; font-weight: 600; line-height: 1.42; margin: 0 0 10px; color: var(--ink); }
.ev-card .org { font-size: 13.5px; color: var(--ink-soft); }
.ev-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--hair); display: flex; align-items: center; gap: 12px; }
.ev-mode { font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-faint); display: inline-flex; align-items: center; gap: 9px; }
.ev-pin { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); opacity: .8; flex: 0 0 auto; }
.ev-arrow { margin-left: auto; width: 36px; height: 36px; border-radius: 50%; color: var(--ink-faint); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  box-shadow: inset calc(2px*var(--soft)) calc(2px*var(--soft)) calc(5px*var(--soft)) var(--d-sh), inset calc(-2px*var(--soft)) calc(-2px*var(--soft)) calc(5px*var(--soft)) var(--l-sh);
  transition: color .25s, transform .25s; }
.ev-card:hover .ev-arrow { color: var(--accent); transform: translateX(3px); }

.mod-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.mod-card { border-radius: 26px; padding: 38px; display: flex; gap: 26px; cursor: pointer; align-items: flex-start; }
.mod-card .well { width: 78px; height: 78px; border-radius: 22px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; color: var(--accent); }
.mod-card .body { flex: 1; min-width: 0; }
.mod-card .mhead { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.mod-card h3 { font-family: var(--font-display); font-size: 25px; font-weight: 600; margin: 0; color: var(--ink); }
.mod-card .en { font-family: var(--font-mono); font-size: 12px; color: var(--ink-faint); letter-spacing: .04em; }
.mod-card p { font-size: 15px; line-height: 1.65; color: var(--ink-soft); margin: 13px 0 22px; }
.mod-card .mfoot { display: flex; align-items: center; justify-content: space-between; }
.mod-card:hover .arrow-dot { color: var(--accent); transform: translateX(3px); }

/* ============================================================
   FOOTER + reveal
   ============================================================ */
.ka-foot { margin-top: 100px; padding: 46px 0 44px; border-top: 1px solid var(--hair); }
.ka-foot .in { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.ka-foot .l { display: flex; align-items: center; gap: 18px; }
.ka-foot .cr { font-size: 13px; color: var(--ink-faint); }
.ka-foot .links { display: flex; gap: 26px; flex-wrap: wrap; }
.ka-foot .links a { font-size: 13.5px; color: var(--ink-soft); transition: color .2s; }
.ka-foot .links a:hover { color: var(--accent); }

.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.2,.7,.3,1), transform .7s cubic-bezier(.2,.7,.3,1); }
.reveal.in { opacity: 1; transform: none; }
.ka-route { animation: kaFade .42s cubic-bezier(.2,.7,.3,1); }
@keyframes kaFade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } .ka-route { animation: none; } }

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 940px) {
  .ev-row { grid-template-columns: 1fr; }
  .mod-grid { grid-template-columns: 1fr; }
  .ka-nav .links { display: none; }
  .ka-menu-btn { display: inline-flex; }
}
@media (max-width: 620px) {
  .kc { padding: 0 20px; }
  .h-stats { flex-wrap: wrap; }
  .h-stat { flex: 1 1 45%; }
  .h-stat:nth-child(2) { border-left: none; }
  .mod-card { flex-direction: column; gap: 18px; padding: 28px; }
  .h-hero { padding: 60px 0 40px; }
}
