/* ==============================================================================
   ReactDrops 现代动效与微交互系统 (ReactDrops UI & Motion Suite)
   参考来源：https://reactdrops.dev/components & https://github.com/crisjavr/reactdrops
   适配目标：通辽智慧农牧业服务平台 (Tongliao Smart Agri-Pastoral Platform)
   
   包含核心组件模式：
   1. TopographicFlow: 农牧空间等高线流体引擎 (Procedural Isolines Canvas)
   2. ShowcasePointer: 政务多角色协同模拟光标与脉冲 (Collaborative Cursors & Ripples)
   3. ChromaticSurface & Button: 彩色镜面高光与聚焦微交互 (Chromatic Specular Highlights)
   4. CatalogCard Micro-interactions: 矢量对角微位移箭头与发丝边框光晕 (Arrow Spring & Glow)
   5. RefractedTypography: 农政标题高光折射微扫掠 (Chromatic Sheen)
   ============================================================================== */

:root {
  --rd-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --rd-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --rd-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --rd-topographic-emerald: rgba(67, 194, 139, 0.28);
  --rd-topographic-lime: rgba(196, 247, 96, 0.35);
  --rd-topographic-dark: rgba(21, 131, 86, 0.18);
}

/* ── 1. Topographic Flow (等高线流体画布) ─────────────────────── */
.topographic-flow-container {
  position: relative !important;
  overflow: hidden !important;
  isolation: isolate !important;
}

.topographic-flow-canvas {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
  z-index: 1 !important;
  opacity: 0.82;
  transition: opacity 0.6s var(--rd-ease);
}

.topographic-flow-canvas.is-ready {
  animation: rd-fade-in 800ms var(--rd-spring) both;
}

@keyframes rd-fade-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 0.82; transform: scale(1); }
}

/* ── 2. Showcase Pointer (政务多角色模拟光标系统) ─────────────── */
.showcase-pointer-overlay {
  position: absolute !important;
  inset: 0 !important;
  z-index: 25 !important;
  pointer-events: none !important;
  overflow: hidden !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.showcase-pointer-cursor {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  transform: translate3d(var(--x, 0px), var(--y, 0px), 0) !important;
  will-change: transform !important;
  pointer-events: none !important;
  opacity: 0;
  transition: opacity 0.28s var(--rd-ease);
}

.showcase-pointer-cursor.is-visible {
  opacity: 1 !important;
}

.showcase-pointer-body {
  position: relative;
  display: flex;
  align-items: flex-start;
  transform-origin: 4px 4px;
  transition: transform 0.16s var(--rd-spring);
}

.showcase-pointer-cursor[data-pressed="true"] .showcase-pointer-body {
  transform: scale(0.86);
}

.showcase-pointer-arrow {
  display: block;
  width: 24px;
  height: 24px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.showcase-pointer-arrow path {
  fill: var(--cursor-color, #10b981);
  stroke: #ffffff;
  stroke-width: 1.6;
  stroke-linejoin: round;
}

.showcase-pointer-label {
  position: absolute;
  top: 22px;
  left: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 9999px;
  background: var(--cursor-color, #10b981);
  color: var(--cursor-text, #ffffff);
  font-family: "Albert Sans", -apple-system, sans-serif;
  font-size: 11px;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: -0.01em;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  animation: rd-label-pop 0.36s var(--rd-bounce) both;
}

@keyframes rd-label-pop {
  from { opacity: 0; transform: scale(0.7) translateY(-4px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.showcase-pointer-ripple {
  position: absolute;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--ripple-color, #10b981);
  background: color-mix(in srgb, var(--ripple-color, #10b981) 22%, transparent);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.2);
  opacity: 0.95;
  animation: rd-ripple-out 0.7s var(--rd-spring) forwards;
}

@keyframes rd-ripple-out {
  0% { transform: translate(-50%, -50%) scale(0.2); opacity: 0.95; }
  100% { transform: translate(-50%, -50%) scale(1.6); opacity: 0; }
}

.pointer-toggle-pill {
  cursor: pointer !important;
  user-select: none !important;
  transition: all 0.2s var(--rd-ease) !important;
  border: 1px solid rgba(196, 247, 96, 0.3) !important;
}

.pointer-toggle-pill:hover {
  background: rgba(196, 247, 96, 0.25) !important;
  border-color: rgba(196, 247, 96, 0.7) !important;
  transform: scale(1.04) !important;
}

/* ── 3. Chromatic Specular Buttons & Surfaces (彩色镜面高光按钮) ─ */
.portal-btn-green,
.opendesign-btn-primary {
  position: relative !important;
  isolation: isolate !important;
  overflow: hidden !important;
  background: radial-gradient(
    ellipse at var(--chromatic-focus-x, 35%) var(--chromatic-focus-y, 0%),
    #dcfcb0 0%,
    #63fe13 48%,
    #a3e635 100%
  ) !important;
  color: #08120e !important;
  font-weight: 800 !important;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.75),
    inset 0 -2px 6px rgba(21, 131, 86, 0.35),
    0 4px 16px rgba(196, 247, 96, 0.32) !important;
  transition:
    transform 0.24s var(--rd-spring),
    box-shadow 0.24s var(--rd-ease),
    background 0.24s var(--rd-ease) !important;
}

.portal-btn-green:hover,
.opendesign-btn-primary:hover {
  transform: translateY(-2px) scale(1.02) !important;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.9),
    inset 0 -2px 8px rgba(21, 131, 86, 0.45),
    0 10px 28px rgba(196, 247, 96, 0.5) !important;
}

.portal-btn-dark,
.opendesign-btn-secondary {
  position: relative !important;
  isolation: isolate !important;
  overflow: hidden !important;
  background: radial-gradient(
    ellipse at var(--chromatic-focus-x, 35%) var(--chromatic-focus-y, 0%),
    #13241c 0%,
    #08120e 65%,
    #040a08 100%
  ) !important;
  color: #ffffff !important;
  border-color: rgba(67, 194, 139, 0.35) !important;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.2),
    inset 0 -2px 6px rgba(67, 194, 139, 0.28),
    0 6px 18px rgba(0, 0, 0, 0.35) !important;
  transition:
    transform 0.24s var(--rd-spring),
    box-shadow 0.24s var(--rd-ease),
    border-color 0.24s var(--rd-ease) !important;
}

.portal-btn-dark:hover,
.opendesign-btn-secondary:hover {
  transform: translateY(-2px) scale(1.02) !important;
  border-color: rgba(196, 247, 96, 0.6) !important;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.32),
    inset 0 -2px 8px rgba(67, 194, 139, 0.45),
    0 12px 28px rgba(0, 0, 0, 0.48) !important;
}

/* 按钮微动效入场: blur-up */
.rd-entrance-blur-up {
  animation: rd-blur-up 0.55s var(--rd-spring) both;
}

@keyframes rd-blur-up {
  from {
    opacity: 0;
    filter: blur(8px);
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: translateY(0);
  }
}

/* ── 4. ReactDrops Catalog Card (卡片微交互与对角位移箭头) ────── */
.card-arrow-badge {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 28px !important;
  height: 28px !important;
  border-radius: 9999px !important;
  background: rgba(67, 194, 139, 0.12) !important;
  color: var(--green-dark, #218c00) !important;
  transition:
    transform 0.28s var(--rd-spring),
    background 0.28s var(--rd-ease),
    color 0.28s var(--rd-ease) !important;
  flex-shrink: 0 !important;
}

.card-arrow-badge svg {
  width: 14px !important;
  height: 14px !important;
  stroke: currentColor !important;
  stroke-width: 2.2 !important;
  fill: none !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  transition: transform 0.28s var(--rd-spring) !important;
}

/* 悬停微动效：卡片整体上浮，右侧箭头向右上对角微位移 */
.key-scenario-card:hover .card-arrow-badge,
.priority-platform-card:hover .card-arrow-badge,
.portal-btn:hover .card-arrow-badge {
  background: var(--lime, #63fe13) !important;
  color: #08120e !important;
  transform: scale(1.1) !important;
}

.key-scenario-card:hover .card-arrow-badge svg,
.priority-platform-card:hover .card-arrow-badge svg,
.portal-btn:hover .card-arrow-badge svg {
  transform: translate(2px, -2px) !important;
}

.key-scenario-card,
.priority-platform-card {
  position: relative !important;
  transition:
    transform 0.3s var(--rd-spring),
    box-shadow 0.3s var(--rd-ease),
    border-color 0.3s var(--rd-ease) !important;
}

.key-scenario-card:hover,
.priority-platform-card:hover {
  transform: translateY(-4px) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.08) !important;
  border-color: rgba(67, 194, 139, 0.45) !important;
}

.priority-platform-card.is-lead:hover {
  box-shadow: 0 24px 54px rgba(5, 14, 10, 0.45) !important;
  border-color: rgba(196, 247, 96, 0.5) !important;
}

/* ── 5. Refracted Typography / Sheen (文字折射扫掠) ────────── */
.refracted-sheen {
  background: linear-gradient(
    115deg,
    #ffffff 20%,
    #63fe13 42%,
    #43c28b 55%,
    #ffffff 80%
  ) !important;
  background-size: 240% auto !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
  animation: rd-sheen-cycle 8s ease-in-out infinite !important;
}

@keyframes rd-sheen-cycle {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

/* ── 6. 无障碍动画抑制支持 (Reduced Motion) ───────────────────── */
@media (prefers-reduced-motion: reduce) {
  .topographic-flow-canvas,
  .showcase-pointer-cursor,
  .showcase-pointer-ripple,
  .showcase-pointer-label,
  .card-arrow-badge,
  .card-arrow-badge svg,
  .refracted-sheen {
    animation: none !important;
    transition: none !important;
  }
}
