/* ============================================================
   IPAI Executive AI DataHub — Design System
   Matches www.ipai.hk brand identity
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500&family=Noto+Sans+TC:wght@300;400;500;700&family=Noto+Serif+TC:wght@400;600;700&display=swap');

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --deep-black: #0A0A0F;
  --surface-black: #12121A;
  --true-black: #050508;
  --warm-white: #F5F5F7;
  --pure-white: #FFFFFF;
  --magenta: #E91E8C;
  --indigo: #4F46E5;
  --cyan: #06B6D4;
  --charcoal: #2A2A35;
  --gray-medium: #6B7280;
  --gray-light: #9CA3AF;
  --surface-border: rgba(255,255,255,0.06);
  --surface-hover: rgba(255,255,255,0.1);
  --brand-gradient: linear-gradient(135deg, #E91E8C 0%, #4F46E5 50%, #06B6D4 100%);
  --brand-gradient-soft: linear-gradient(135deg, rgba(233,30,140,0.15) 0%, rgba(79,70,229,0.15) 50%, rgba(6,182,212,0.15) 100%);
  --brand-glow: radial-gradient(ellipse at center, rgba(233,30,140,0.25) 0%, rgba(79,70,229,0.15) 40%, transparent 70%);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 16px;
  --radius-sm: 8px;
  --radius-lg: 24px;
}

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--deep-black);
  color: var(--warm-white);
  font-family: 'Noto Sans TC', sans-serif;
  font-weight: 400;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Noto Serif TC', serif;
  color: var(--warm-white);
  line-height: 1.2;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
::selection { background: rgba(233,30,140,0.3); color: var(--warm-white); }

/* ── Layout ────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (min-width: 768px) {
  .container { padding: 0 80px; }
}

.section { padding: 80px 0; }

@media (min-width: 768px) {
  .section { padding: 120px 0; }
}

/* ── Eyebrow Label ─────────────────────────────────────────── */
.eyebrow {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.15em;
  color: var(--magenta);
  text-transform: uppercase;
  margin-bottom: 16px;
  display: inline-block;
}

/* ── Navbar ────────────────────────────────────────────────── */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 16px 0;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--surface-border);
  transition: all 0.3s var(--ease-smooth);
}

.navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-logo img {
  height: 32px;
  width: 32px;
  border-radius: 8px;
  object-fit: cover;
}

.navbar-logo-brand {
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--warm-white);
  letter-spacing: 0.02em;
}

.navbar-logo-text {
  font-family: 'Noto Serif TC', serif;
  font-size: 18px;
  font-weight: 600;
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-links {
  display: none;
  gap: 32px;
  list-style: none;
}

.navbar-links a {
  font-size: 14px;
  color: var(--gray-light);
  transition: color 0.2s;
  letter-spacing: 0.02em;
}

.navbar-links a:hover { color: var(--warm-white); }

@media (min-width: 768px) {
  .navbar-links { display: flex; }
}

.navbar-cta {
  padding: 8px 20px;
  background: var(--magenta);
  color: var(--pure-white);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
  font-family: 'Noto Sans TC', sans-serif;
}

.navbar-cta:hover {
  box-shadow: 0 8px 30px rgba(233,30,140,0.25);
  transform: translateY(-1px);
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  padding-top: 72px;
  overflow: hidden;
}

.hero-glow {
  position: absolute;
  top: -20%;
  left: 50%;
  transform: translateX(-50%);
  width: 800px;
  height: 800px;
  background: var(--brand-glow);
  filter: blur(100px);
  opacity: 0.6;
  pointer-events: none;
  animation: pulseGlow 4s ease-in-out infinite;
}

.hero-content {
  text-align: center;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.hero h1 {
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 24px;
  line-height: 1.15;
}

.hero h1 .gradient-text {
  background: var(--brand-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 16px;
  color: var(--gray-light);
  max-width: 600px;
  margin: 0 auto 40px;
  line-height: 1.8;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin-bottom: 48px;
}

.hero-badge {
  padding: 6px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--surface-border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--gray-light);
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

.hero-badge .badge-icon { margin-right: 6px; }

.hero-cta-group {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-primary {
  padding: 14px 32px;
  background: var(--magenta);
  color: var(--pure-white);
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
  font-family: 'Noto Sans TC', sans-serif;
}

.btn-primary:hover {
  box-shadow: 0 8px 30px rgba(233,30,140,0.3);
  transform: translateY(-2px);
}

.btn-outline {
  padding: 14px 32px;
  background: transparent;
  color: var(--warm-white);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s var(--ease-smooth);
  font-family: 'Noto Sans TC', sans-serif;
}

.btn-outline:hover {
  border-color: rgba(255,255,255,0.25);
  background: rgba(255,255,255,0.04);
}

@media (min-width: 768px) {
  .hero h1 { font-size: 52px; }
  .hero-subtitle { font-size: 18px; }
}

/* ── Glass Card ────────────────────────────────────────────── */
.glass-card {
  background: rgba(18,18,26,0.6);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: all 0.35s var(--ease-smooth);
}

.glass-card:hover {
  border-color: rgba(255,255,255,0.12);
  background: rgba(18,18,26,0.8);
  transform: translateY(-4px);
}

/* ── KPI Cards ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

.kpi-card {
  padding: 24px;
  position: relative;
  overflow: hidden;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.3s;
}

.kpi-card:hover::before { opacity: 1; }

.kpi-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.kpi-label {
  font-size: 12px;
  color: var(--gray-light);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 8px;
  font-family: 'JetBrains Mono', monospace;
}

.kpi-value {
  font-size: 32px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--warm-white);
  line-height: 1;
}

.kpi-change {
  font-size: 12px;
  margin-top: 8px;
  font-family: 'JetBrains Mono', monospace;
}

.kpi-change.up { color: #10B981; }
.kpi-change.down { color: #EF4444; }

/* ── Pipeline ──────────────────────────────────────────────── */
.pipeline {
  display: flex;
  overflow-x: auto;
  gap: 0;
  padding: 20px 0;
  -webkit-overflow-scrolling: touch;
}

.pipeline::-webkit-scrollbar { display: none; }

.pipeline-stage {
  flex: 0 0 auto;
  min-width: 180px;
  padding: 24px 20px;
  text-align: center;
  position: relative;
  background: rgba(18,18,26,0.6);
  border: 1px solid var(--surface-border);
  transition: all 0.3s var(--ease-smooth);
}

.pipeline-stage:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.pipeline-stage:last-child { border-radius: 0 var(--radius) var(--radius) 0; }

.pipeline-stage:not(:last-child)::after {
  content: '→';
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--magenta);
  font-size: 18px;
  z-index: 2;
}

.pipeline-stage:hover {
  background: rgba(233,30,140,0.08);
  border-color: rgba(233,30,140,0.2);
}

.pipeline-icon { font-size: 28px; margin-bottom: 8px; }

.pipeline-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
}

.pipeline-value {
  font-size: 18px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  color: var(--cyan);
}

.pipeline-sub {
  font-size: 11px;
  color: var(--gray-light);
  margin-top: 4px;
}

/* ── Chat Demo ─────────────────────────────────────────────── */
.chat-container {
  max-width: 640px;
  margin: 0 auto;
  background: var(--surface-black);
  border: 1px solid var(--surface-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--surface-border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-header-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #10B981;
  animation: pulseGlow 2s ease-in-out infinite;
}

.chat-header-title {
  font-size: 14px;
  font-weight: 500;
}

.chat-messages {
  padding: 20px;
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  animation: fadeInUp 0.4s ease-out;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--magenta);
  color: var(--pure-white);
  border-bottom-right-radius: 4px;
}

.chat-msg.ai {
  align-self: flex-start;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--surface-border);
  border-bottom-left-radius: 4px;
}

.chat-msg.ai .ai-label {
  font-size: 11px;
  color: var(--cyan);
  font-family: 'JetBrains Mono', monospace;
  margin-bottom: 6px;
  letter-spacing: 0.05em;
}

.chat-input-bar {
  padding: 16px 20px;
  border-top: 1px solid var(--surface-border);
  display: flex;
  gap: 12px;
}

.chat-input {
  flex: 1;
  padding: 10px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  color: var(--warm-white);
  font-size: 14px;
  font-family: 'Noto Sans TC', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

.chat-input:focus { border-color: rgba(233,30,140,0.4); }
.chat-input::placeholder { color: var(--gray-medium); }

.chat-send {
  padding: 10px 20px;
  background: var(--magenta);
  color: var(--pure-white);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'Noto Sans TC', sans-serif;
  font-size: 14px;
  transition: all 0.2s;
}

.chat-send:hover { box-shadow: 0 4px 15px rgba(233,30,140,0.3); }

/* ── Architecture Diagram ──────────────────────────────────── */
.arch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 768px) {
  .arch-grid { grid-template-columns: 1fr auto 1fr; align-items: center; }
}

.arch-box {
  padding: 32px;
}

.arch-box-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.arch-box-title .arch-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}

.arch-box-title .arch-dot.magenta { background: var(--magenta); }
.arch-box-title .arch-dot.cyan { background: var(--cyan); }

.arch-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.arch-list li {
  font-size: 14px;
  color: var(--gray-light);
  padding-left: 20px;
  position: relative;
  line-height: 1.6;
}

.arch-list li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--magenta);
  font-weight: 700;
}

.arch-connector {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--gray-medium);
  font-size: 24px;
}

@media (min-width: 768px) {
  .arch-connector { display: flex; }
}

.arch-connector-line {
  width: 2px;
  height: 40px;
  background: var(--brand-gradient);
  border-radius: 1px;
}

/* ── Feature Grid ──────────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 768px) {
  .feature-grid { grid-template-columns: repeat(3, 1fr); }
}

.feature-card {
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.feature-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: radial-gradient(ellipse at top, rgba(233,30,140,0.06) 0%, transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.feature-card:hover::after { opacity: 1; }

.feature-icon {
  font-size: 32px;
  margin-bottom: 16px;
}

.feature-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
  font-family: 'Noto Serif TC', serif;
}

.feature-desc {
  font-size: 14px;
  color: var(--gray-light);
  line-height: 1.7;
}

/* ── Section Titles ────────────────────────────────────────── */
.section-header {
  text-align: center;
  margin-bottom: 60px;
}

.section-header h2 {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 16px;
}

.section-header p {
  font-size: 16px;
  color: var(--gray-light);
  max-width: 600px;
  margin: 0 auto;
  line-height: 1.8;
}

@media (min-width: 768px) {
  .section-header h2 { font-size: 40px; }
}

/* ── Infra Section ─────────────────────────────────────────── */
.infra-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .infra-grid { grid-template-columns: repeat(3, 1fr); }
}

.infra-card {
  padding: 28px;
  text-align: center;
}

.infra-icon { font-size: 36px; margin-bottom: 12px; }

.infra-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.infra-desc {
  font-size: 13px;
  color: var(--gray-light);
  line-height: 1.7;
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
  padding: 48px 0;
  border-top: 1px solid var(--surface-border);
  text-align: center;
}

.footer-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.footer-logo img { height: 28px; }

.footer-text {
  font-size: 13px;
  color: var(--gray-medium);
}

.footer-text a {
  color: var(--magenta);
  transition: color 0.2s;
}

.footer-text a:hover { color: var(--cyan); }

/* ── Animations ────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

@keyframes gradientShimmer {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

@keyframes countUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes typingDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

.animate-on-scroll {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s var(--ease-out-expo);
}

.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

.typing-dots span {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gray-light);
  animation: typingDot 1.4s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

/* ── Gradient Border Featured Card ─────────────────────────── */
.gradient-border {
  position: relative;
  background: rgba(18,18,26,0.8);
  border-radius: var(--radius);
  overflow: hidden;
}

.gradient-border::before {
  content: '';
  position: absolute;
  inset: 0;
  padding: 1px;
  border-radius: var(--radius);
  background: var(--brand-gradient);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

/* ── Responsive Utils ──────────────────────────────────────── */
.hide-mobile { display: none; }
@media (min-width: 768px) { .hide-mobile { display: block; } }
.hide-desktop { display: block; }
@media (min-width: 768px) { .hide-desktop { display: none; } }
