/* ============================================================
   ZY Action Platform - Common Styles
   亮色主题 · 科技感 · 企业商务 · 移动端响应式
   ============================================================ */

/* --- CSS Variables / Design Tokens --- */
:root {
  /* Primary palette */
  --c-primary: #2563eb;
  --c-primary-light: #3b82f6;
  --c-primary-dark: #1d4ed8;
  --c-primary-bg: #eff6ff;

  /* Accent */
  --c-accent: #0891b2;
  --c-accent-light: #06b6d4;
  --c-accent-bg: #ecfeff;

  /* Neutral */
  --c-bg: #f8fafc;
  --c-surface: #ffffff;
  --c-border: #e2e8f0;
  --c-border-light: #f1f5f9;

  /* Text */
  --c-text: #0f172a;
  --c-text-secondary: #475569;
  --c-text-muted: #94a3b8;

  /* Semantic */
  --c-success: #16a34a;
  --c-warning: #ea580c;
  --c-danger: #dc2626;

  /* Product colors */
  --c-foundry: #7c3aed;
  --c-foundry-bg: #f5f3ff;
  --c-aip: #2563eb;
  --c-aip-bg: #eff6ff;
  --c-gotham: #0891b2;
  --c-gotham-bg: #ecfeff;
  --c-apollo: #ea580c;
  --c-apollo-bg: #fff7ed;
  --c-swift: #059669;
  --c-swift-bg: #ecfdf5;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.04);

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* Layout */
  --max-w: 1200px;
  --header-h: 64px;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-normal: 250ms ease;
  --t-slow: 400ms cubic-bezier(.4,0,.2,1);
}

/* --- Reset & Base --- */
*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--c-primary); text-decoration: none; transition: color var(--t-fast); }
a:hover { color: var(--c-primary-dark); }

img { max-width: 100%; display: block; }

ul, ol { list-style: none; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 { line-height: 1.3; font-weight: 700; }
h1 { font-size: 2.5rem; letter-spacing: -.02em; }
h2 { font-size: 1.875rem; letter-spacing: -.01em; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.125rem; }

.section-title {
  font-size: 1.875rem;
  text-align: center;
  margin-bottom: .5rem;
}
.section-subtitle {
  text-align: center;
  color: var(--c-text-secondary);
  font-size: 1.05rem;
  margin-bottom: 3rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* --- Utility --- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.text-muted { color: var(--c-text-muted); }
.text-secondary { color: var(--c-text-secondary); }

/* --- Badge / Tag --- */
.badge {
  display: inline-block;
  padding: .2em .65em;
  font-size: .8rem;
  font-weight: 600;
  border-radius: 99px;
  letter-spacing: .01em;
}
.badge-blue  { background: var(--c-primary-bg); color: var(--c-primary); }
.badge-teal  { background: var(--c-accent-bg);  color: var(--c-accent); }
.badge-green { background: var(--c-swift-bg);   color: var(--c-success); }

/* ============================================================
   HEADER / NAVIGATION
   ============================================================ */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--header-h);
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  transition: box-shadow var(--t-normal);
}
.header.scrolled { box-shadow: var(--shadow-md); }

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--c-text);
  letter-spacing: -.01em;
  white-space: nowrap;
}
.logo-icon {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.1rem;
  font-weight: 800;
  flex-shrink: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: .25rem;
}
.nav-links a {
  padding: .45rem .85rem;
  border-radius: var(--r-sm);
  color: var(--c-text-secondary);
  font-size: .9rem;
  font-weight: 500;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--c-primary);
  background: var(--c-primary-bg);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none; border: none;
  cursor: pointer;
  padding: .5rem;
  z-index: 1001;
}
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--c-text);
  border-radius: 2px;
  transition: all var(--t-fast);
}
.nav-toggle.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.open span:nth-child(2) { opacity: 0; }
.nav-toggle.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ============================================================
   HERO SECTION
   ============================================================ */
.hero {
  padding: calc(var(--header-h) + 4rem) 0 4rem;
  background: linear-gradient(180deg, #f0f4ff 0%, var(--c-bg) 100%);
  text-align: center;
  overflow: hidden;
  position: relative;
}
.hero::before {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(ellipse at 30% 20%, rgba(37,99,235,.04) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 60%, rgba(8,145,178,.04) 0%, transparent 60%);
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  margin-bottom: 1rem;
}
.hero h1 .gradient-text {
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero .hero-desc {
  font-size: 1.15rem;
  color: var(--c-text-secondary);
  max-width: 700px;
  margin: 0 auto 2rem;
}
.hero-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem 1.5rem;
  border-radius: var(--r-sm);
  font-size: .925rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.btn-primary {
  background: var(--c-primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.btn-primary:hover { background: var(--c-primary-dark); color: #fff; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(37,99,235,.35); }

.btn-outline {
  background: transparent;
  color: var(--c-primary);
  border: 1.5px solid var(--c-primary);
}
.btn-outline:hover { background: var(--c-primary-bg); }

.btn-lg { padding: .8rem 2rem; font-size: 1rem; }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1.75rem;
  transition: all var(--t-normal);
  box-shadow: var(--shadow-sm);
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--c-border-light);
}

/* Product card */
.product-card {
  position: relative;
  overflow: hidden;
}
.product-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 3px;
  transform: scaleX(0);
  transition: transform var(--t-slow);
}
.product-card:hover::after { transform: scaleX(1); }
.product-card.foundry::after { background: var(--c-foundry); }
.product-card.aip::after     { background: var(--c-aip); }
.product-card.gotham::after  { background: var(--c-gotham); }
.product-card.apollo::after  { background: var(--c-apollo); }
.product-card.swift::after   { background: var(--c-swift); }

.product-card .card-icon {
  width: 48px; height: 48px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 1rem;
}
.pc-foundry .card-icon { background: var(--c-foundry-bg); color: var(--c-foundry); }
.pc-aip .card-icon     { background: var(--c-aip-bg);     color: var(--c-aip); }
.pc-gotham .card-icon  { background: var(--c-gotham-bg);  color: var(--c-gotham); }
.pc-apollo .card-icon  { background: var(--c-apollo-bg);  color: var(--c-apollo); }
.pc-swift .card-icon   { background: var(--c-swift-bg);   color: var(--c-swift); }

.product-card h3 { font-size: 1.2rem; margin-bottom: .35rem; }
.product-card .card-tagline { font-size: .85rem; color: var(--c-text-muted); margin-bottom: .75rem; }
.product-card .card-features {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .75rem;
}
.product-card .card-features span {
  font-size: .78rem;
  padding: .15em .55em;
  border-radius: 99px;
  background: var(--c-bg);
  color: var(--c-text-secondary);
}

/* ============================================================
   PRODUCT GRID
   ============================================================ */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.5rem;
}

/* ============================================================
   ARCHITECTURE DIAGRAM (ASCII style in HTML)
   ============================================================ */
.arch-diagram {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 2rem;
  overflow-x: auto;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: .82rem;
  line-height: 1.7;
  color: var(--c-text-secondary);
  white-space: pre;
  box-shadow: var(--shadow-md);
}

/* ============================================================
   FEATURE / CAPABILITY LIST
   ============================================================ */
.cap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}
.cap-item {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 1.25rem 1.5rem;
  display: flex;
  gap: .85rem;
  align-items: flex-start;
  transition: all var(--t-fast);
}
.cap-item:hover { border-color: var(--c-primary-light); box-shadow: var(--shadow-sm); }
.cap-item .cap-icon {
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  margin-top: 2px;
}
.cap-item .cap-info h4 { font-size: .95rem; margin-bottom: .15rem; }
.cap-item .cap-info p  { font-size: .85rem; color: var(--c-text-secondary); }

/* ============================================================
   COMPARISON TABLE
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-sm);
}
table.comparison {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
  background: var(--c-surface);
}
table.comparison thead { background: var(--c-bg); }
table.comparison th {
  padding: .85rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--c-text-secondary);
  border-bottom: 2px solid var(--c-border);
  white-space: nowrap;
}
table.comparison td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--c-border-light);
  color: var(--c-text-secondary);
}
table.comparison td:first-child { color: var(--c-text); font-weight: 500; }
table.comparison tr:last-child td { border-bottom: none; }
table.comparison tbody tr:hover { background: #fafbfc; }

/* ============================================================
   TIMELINE / PHASES
   ============================================================ */
.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}
.timeline .phase {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1.75rem;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.timeline .phase .phase-num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--c-border);
  position: absolute;
  top: .75rem; right: 1rem;
}
.timeline .phase h3 { font-size: 1.05rem; margin-bottom: .5rem; }
.timeline .phase .phase-period { font-size: .8rem; color: var(--c-primary); font-weight: 600; margin-bottom: .75rem; }
.timeline .phase ul { font-size: .88rem; color: var(--c-text-secondary); }
.timeline .phase ul li { padding: .25rem 0; }
.timeline .phase ul li::before { content: '─ '; color: var(--c-primary-light); }

/* ============================================================
   SECTION SPACING
   ============================================================ */
.section {
  padding: 5rem 0;
}
.section-light {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  border-bottom: 1px solid var(--c-border);
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  background: var(--c-text);
  color: rgba(255,255,255,.7);
  padding: 3rem 0 2rem;
  font-size: .88rem;
}
.footer .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 2rem; }
.footer a { color: rgba(255,255,255,.7); }
.footer a:hover { color: #fff; }
.footer .footer-brand { font-weight: 700; color: #fff; font-size: 1.05rem; }
.footer .footer-links { display: flex; gap: 2rem; flex-wrap: wrap; }
.footer-bottom {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255,255,255,.1);
  text-align: center;
  font-size: .8rem;
  color: rgba(255,255,255,.4);
}

/* ============================================================
   PRODUCT HERO (subpages)
   ============================================================ */
.product-hero {
  padding: calc(var(--header-h) + 3rem) 0 3rem;
  text-align: center;
}
.product-hero .product-badge {
  display: inline-block;
  padding: .25em .8em;
  font-size: .85rem;
  font-weight: 600;
  border-radius: 99px;
  margin-bottom: 1rem;
}
.product-hero h1 { margin-bottom: .75rem; }
.product-hero .hero-tagline { font-size: 1.15rem; color: var(--c-text-secondary); max-width: 600px; margin: 0 auto 1.5rem; }

/* Product hero color themes */
.ph-foundry { background: linear-gradient(180deg, #f5f3ff 0%, var(--c-bg) 100%); }
.ph-foundry .product-badge { background: var(--c-foundry-bg); color: var(--c-foundry); }
.ph-aip     { background: linear-gradient(180deg, #eff6ff 0%, var(--c-bg) 100%); }
.ph-aip .product-badge     { background: var(--c-aip-bg);     color: var(--c-aip); }
.ph-gotham  { background: linear-gradient(180deg, #ecfeff 0%, var(--c-bg) 100%); }
.ph-gotham .product-badge  { background: var(--c-gotham-bg);  color: var(--c-gotham); }
.ph-apollo  { background: linear-gradient(180deg, #fff7ed 0%, var(--c-bg) 100%); }
.ph-apollo .product-badge  { background: var(--c-apollo-bg);  color: var(--c-apollo); }
.ph-swift   { background: linear-gradient(180deg, #ecfdf5 0%, var(--c-bg) 100%); }
.ph-swift .product-badge   { background: var(--c-swift-bg);   color: var(--c-swift); }

/* ============================================================
   TECH STACK BAR
   ============================================================ */
.tech-stack {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  justify-content: center;
  margin-top: 1rem;
}
.tech-stack .tech-item {
  padding: .35rem .85rem;
  border-radius: 99px;
  font-size: .82rem;
  font-weight: 500;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  color: var(--c-text-secondary);
  transition: all var(--t-fast);
}
.tech-stack .tech-item:hover { border-color: var(--c-primary-light); color: var(--c-primary); }

/* ============================================================
   STATS COUNTER
   ============================================================ */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: center;
  text-align: center;
}
.stat-item .stat-num {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.stat-item .stat-label { font-size: .9rem; color: var(--c-text-muted); margin-top: .15rem; }

/* ============================================================
   SCROLL REVEAL (JS-driven via IntersectionObserver)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .6s ease, transform .6s ease;
}
.reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   TAB PANELS (used in product subpages)
   ============================================================ */
.tab-panel {
  display: none;
  animation: fadeIn .3s ease;
}
.tab-panel.active {
  display: block;
}

[data-tab].active {
  background: var(--c-primary) !important;
  color: #fff !important;
  border-color: var(--c-primary) !important;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.anim-fade-up {
  animation: fadeInUp .6s ease both;
}
.anim-fade-up:nth-child(1) { animation-delay: 0s; }
.anim-fade-up:nth-child(2) { animation-delay: .1s; }
.anim-fade-up:nth-child(3) { animation-delay: .2s; }
.anim-fade-up:nth-child(4) { animation-delay: .3s; }
.anim-fade-up:nth-child(5) { animation-delay: .4s; }
.anim-fade-up:nth-child(6) { animation-delay: .5s; }

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 2rem; right: 2rem;
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--c-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transition: all var(--t-normal);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.back-to-top.visible { opacity: 1; pointer-events: auto; }
.back-to-top:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root { --header-h: 56px; }

  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.5rem; }
  .section { padding: 3rem 0; }
  .section-title { font-size: 1.5rem; }

  /* Mobile nav */
  .nav-toggle { display: flex; }
  /* 关键：header 的 backdrop-filter 会使内部 position:fixed 后代以 header 为包含块，
     导致移动端全屏导航层无法铺满视口、直接透出页面内容，必须在此禁用 */
  .header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: #ffffff;
  }
  .nav-links {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #ffffff;
    flex-direction: column;
    justify-content: center;
    gap: .5rem;
    transform: translateX(100%);
    transition: transform var(--t-slow);
    z-index: 1000;
  }
  .nav-links.open { transform: translateX(0); }
  .nav-links a { font-size: 1.1rem; padding: .7rem 1.5rem; }

  .product-grid { grid-template-columns: 1fr; }
  .cap-grid { grid-template-columns: 1fr; }
  .timeline { grid-template-columns: 1fr; }
  .stats-row { gap: 1.5rem; }
  .stat-item .stat-num { font-size: 2rem; }

  .hero { padding: calc(var(--header-h) + 2.5rem) 0 2.5rem; }
  .footer .container { flex-direction: column; text-align: center; }
  .footer .footer-links { justify-content: center; }

  table.comparison { font-size: .8rem; }
  table.comparison th, table.comparison td { padding: .5rem .65rem; }
}

@media (max-width: 480px) {
  .hero-actions { flex-direction: column; align-items: center; }
  .btn { width: 100%; justify-content: center; }

  .card { padding: 1.25rem; }
  .arch-diagram { font-size: .7rem; padding: 1rem; }
}
