/* Theme variables */
:root {
  --brand-primary: #3b82f6; /* deeper blue */
  --brand-primary-600: #2563eb; /* even deeper blue */
  --brand-accent: #22c55e;
  --text-primary: #0b1220;
  --text-secondary: #4b5563;
  --bg: #ffffff;
  --bg-muted: #f7f8fa;
  --border: #e5e7eb;
  --max-content-width: 1160px;
  --max-content-width-xl: 1400px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 30px rgba(0,0,0,0.08);
}

/* Base typography */
body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Heiti SC", "WenQuanYi Micro Hei", sans-serif;
  color: var(--text-primary);
  background: var(--bg);
  line-height: 1.6;
}
html, body { overflow-x: hidden; }

/* Fluid typography */
h1 { font-size: clamp(28px, 4vw, 44px); line-height: 1.2; }
h2 { font-size: clamp(22px, 2.6vw, 28px); }
p, li, a, button { font-size: clamp(14px, 1.4vw, 16px); }

.container {
  width: 100%;
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: 0 20px;
}
@media (min-width: 1600px) {
  .container { max-width: var(--max-content-width-xl); }
  .hero .inner { padding: 96px 0; gap: 40px; }
}
@media (max-width: 360px) {
  .site-header .inner { height: 56px; }
  .brand img { height: 24px; }
  .brand .cn { font-size: 14px; }
  .brand .en { font-size: 11px; }
  .container { padding: 0 12px; }
  .section { padding: 56px 0; }
  .cards { gap: 10px; }
}
@media (max-width: 680px) { .container { padding: 0 16px; } }

.visually-hidden { position: absolute !important; height: 1px; width: 1px; overflow: hidden; clip: rect(1px, 1px, 1px, 1px); white-space: nowrap; }

/* Header & Navigation */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  background: rgba(255,255,255,0.8);
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand img { height: 28px; width: auto; }
.brand .brand-text { display: flex; flex-direction: column; }
@media (min-width: 980px) {
  .brand img { height: 44px; }
}
.brand .cn { font-size: 16px; color: var(--text-primary); }
.brand .en { font-size: 12px; color: var(--text-secondary); }

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-list { display: flex; gap: 8px; }
.nav-list a {
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text-secondary);
}
.nav-list a[aria-current="page"],
.nav-list a:hover {
  color: var(--text-primary);
  background: var(--bg-muted);
}

.nav-cta {
  margin-left: 8px;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
  cursor: pointer;
}
.button.primary {
  background: var(--brand-primary);
  color: white;
  box-shadow: var(--shadow-sm);
}
.button.primary:hover { background: var(--brand-primary-600); transform: translateY(-1px); box-shadow: 0 12px 36px rgba(96,165,250,0.28); }
.button.ghost { background: rgba(255,255,255,0.55); border-color: rgba(229,231,235,0.6); color: var(--text-primary); backdrop-filter: saturate(160%) blur(8px); box-shadow: var(--shadow-sm); }
.button.ghost:hover { background: rgba(255,255,255,0.7); box-shadow: 0 10px 30px rgba(0,0,0,0.08); }

/* Mobile menu */
@media (max-width: 980px) {
  .nav-toggle { display: inline-flex; }
  /* 3D rotate-in drawer */
  .site-header { perspective: 1000px; }
  .site-nav { position: fixed; top: 0; right: 0; bottom: 0; left: auto; width: 78vw; max-width: 360px; background: #fff; border-left: 1px solid var(--border); box-shadow: 0 20px 60px rgba(15,23,42,.22); flex-direction: column; align-items: stretch; padding: 20px; gap: 12px; transform: translateX(100%) rotateY(-18deg); transform-origin: right center; transition: transform .35s cubic-bezier(.2,.7,.2,1); backface-visibility: hidden; z-index: 1300; will-change: transform; visibility: hidden; pointer-events: none; }
  body.nav-open .site-nav { transform: translateX(0) rotateY(0deg); visibility: visible; pointer-events: auto; }
  .nav-list { flex-direction: column; gap: 4px; }
  .nav-list a { padding: 12px 14px; }
  .mobile-overlay { content: ""; position: fixed; inset: 0; background: rgba(15, 23, 42, .4); opacity: 0; pointer-events: none; transition: opacity .25s ease; z-index: 1100; }
  body.nav-open .mobile-overlay { opacity: 1; pointer-events: auto; }
/* Prevent background scroll when drawer open */
body.nav-open { overflow: hidden; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  @media (max-width: 980px) {
    .site-nav { transform: translateX(100%); transition: transform .2s linear; }
    body.nav-open .site-nav { transform: translateX(0); }
  }
}

/* Hero */
.hero {
  background: radial-gradient(1200px 600px at 80% -20%, rgba(59,130,246,0.26), transparent 60%),
              radial-gradient(800px 500px at -10% 10%, rgba(147,197,253,0.3), transparent 60%),
              linear-gradient(180deg, #f7fbff, #ffffff);
  border-bottom: 1px solid var(--border);
}
.hero .inner { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 36px; padding: 80px 0; align-items: center; }
.hero h1 { letter-spacing: -0.4px; }
.hero p.lead { margin-top: 16px; font-size: 18px; color: var(--text-secondary); }
.hero .actions { margin-top: 24px; display: flex; gap: 12px; flex-wrap: wrap; }

/* SPA routes with enhanced animations */
.route { 
  display: none; 
  opacity: 0; 
  transform: translateY(20px) scale(0.98); 
  will-change: opacity, transform; 
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
              transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
.route.active { 
  display: block; 
  opacity: 1; 
  transform: translateY(0) scale(1); 
}

@media (max-width: 980px) {
  .hero .inner { grid-template-columns: 1fr; padding: 56px 0; }
  .hero h1 { font-size: 34px; }
}

/* Phone portrait fine-tuning */
@media (max-width: 680px) {
  .hero .inner { display: flex; flex-direction: column; align-items: center; padding: 48px 0; gap: 20px; text-align: center; }
  .hero .inner > div { width: 100%; }
  .hero .actions { justify-content: center; }
  .hero .inner img { max-width: 88%; margin: 0 auto; height: auto; }
}

/* iPad / small laptop tuning */
@media (max-width: 1280px) and (min-width: 1024px) {
  .site-header .inner { height: 64px; }
  .hero .inner { gap: 32px; padding: 80px 0; }
  .section { padding: 80px 0; }
  .cards { gap: 16px; }
}
@media (max-width: 1024px) and (min-width: 768px) {
  .site-header .inner { height: 60px; }
  .hero .inner { gap: 28px; padding: 64px 0; }
  .section { padding: 72px 0; }
  .cards { gap: 14px; }
}

/* Sections */
section { padding: 72px 0; }
.section-header { margin-bottom: 20px; }
.section-header h2 { font-size: 28px; letter-spacing: -0.2px; }
.section-header p { color: var(--text-secondary); margin-top: 8px; }

/* Cohesive full-width sections */
.section { padding: 80px 0; }
.section.alt { background: var(--bg-muted); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-header.center { text-align: center; max-width: 760px; margin: 0 auto 32px; }

/* Ocean waves background */
.ocean { position: fixed; inset: 0; z-index: -1; overflow: hidden; }
.ocean::before, .ocean::after {
  content: "";
  position: absolute;
  left: -25%; right: -25%;
  height: 280px;
  background: url('../images/wave.svg') repeat-x bottom center / 800px 280px;
  opacity: 0.16;
  animation: waveMove 25s linear infinite;
}
.ocean::after { bottom: -40px; opacity: 0.22; animation-duration: 45s; filter: hue-rotate(-6deg) saturate(1.2); }
@keyframes waveMove { from { transform: translateX(0); } to { transform: translateX(-800px); } }

/* Enhanced page transition animations */
.page-enter { 
  animation: pageEnter 0.6s cubic-bezier(0.4, 0, 0.2, 1) both; 
  will-change: opacity, transform; 
}
@keyframes pageEnter { 
  0% { 
    opacity: 0; 
    transform: translateY(30px) scale(0.95); 
  }
  50% {
    opacity: 0.7;
    transform: translateY(15px) scale(0.98);
  }
  100% { 
    opacity: 1; 
    transform: translateY(0) scale(1); 
  } 
}

/* Slide transition for menu items */
.slide-enter { 
  animation: slideEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1) both; 
}
@keyframes slideEnter { 
  0% { 
    opacity: 0; 
    transform: translateX(-20px); 
  }
  100% { 
    opacity: 1; 
    transform: translateX(0); 
  } 
}

/* Staggered animation for cards */
.card-enter { 
  animation: cardEnter 0.5s cubic-bezier(0.4, 0, 0.2, 1) both; 
}
@keyframes cardEnter { 
  0% { 
    opacity: 0; 
    transform: translateY(20px) rotateX(10deg); 
  }
  100% { 
    opacity: 1; 
    transform: translateY(0) rotateX(0deg); 
  } 
}

/* Reduced motion respect */
@media (prefers-reduced-motion: reduce) {
  .page-enter, .slide-enter, .card-enter { animation-duration: .01s; }
  .route.active { transition-duration: .01s; }
  .route { transform: none; }
}

/* Mobile specific fixes */
@media (max-width: 680px) {
  .brand .brand-text { display: none; }
  .nav-toggle { margin-left: auto; }
  .site-nav { z-index: 1300; }
  .mobile-overlay { z-index: 1200; }
  .ocean { display: none; }
}

/* Ensure hero image scales */
.hero img { max-width: 100%; height: auto; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.card { background: rgba(255,255,255,0.65); backdrop-filter: saturate(160%) blur(8px); border: 1px solid rgba(229,231,235,0.6); border-radius: var(--radius-md); padding: 20px; box-shadow: var(--shadow-sm); transition: transform .15s ease, box-shadow .25s ease, background .25s ease, border-color .25s ease; }
.card:hover { transform: translateY(-2px); box-shadow: 0 12px 36px rgba(0,0,0,0.10); background: rgba(255,255,255,0.78); border-color: rgba(229,231,235,0.9); }
.card h3 { font-size: 18px; margin-bottom: 6px; }
.card p { color: var(--text-secondary); }

@media (max-width: 1200px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .cards { grid-template-columns: 1fr; } }

/* Footer */
.site-footer { background: var(--bg-muted); border-top: 1px solid var(--border); }
.site-footer .inner { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 0; }
.site-footer .copy { color: var(--text-secondary); font-size: 14px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.site-footer .copy a { color: inherit; text-decoration: none; border-bottom: 1px dotted transparent; }
.site-footer .copy a:hover { border-bottom-color: currentColor; }
@media (max-width: 680px) { .site-footer .inner { flex-direction: column; align-items: flex-start; gap: 10px; } }

.police-icon { display: inline-block; width: 16px; height: 16px; vertical-align: -3px; margin-right: 2px; background: url('../images/police-badge.svg') no-repeat center / contain; }

/* CTA Band */
.band-cta { background: linear-gradient(135deg, #3b82f6, #2563eb); color: #fff; }
.band-cta .inner { padding: 48px 0; display: grid; gap: 14px; justify-items: center; text-align: center; }
.band-cta h2 { font-size: 26px; letter-spacing: -0.2px; }
.band-cta p { opacity: 0.92; }
.band-cta .actions { display: flex; gap: 12px; margin-top: 8px; flex-wrap: wrap; }
.band-cta .button.ghost { border-color: rgba(255,255,255,0.7); color: #fff; background: transparent; }
.band-cta .button.ghost:hover { background: rgba(255,255,255,0.12); }

/* Forms */
form .field { display: grid; gap: 8px; margin-bottom: 14px; }
input[type="text"], input[type="email"], input[type="tel"], textarea {
  padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; outline: none; transition: border-color .15s ease, box-shadow .15s ease; background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, textarea:focus { border-color: var(--brand-primary); box-shadow: 0 0 0 3px rgba(10,132,255,.12); }

/* Utilities */
.muted { color: var(--text-secondary); }
.badge { display: inline-block; padding: 6px 10px; background: #eef6ff; color: #1d4ed8; border-radius: 999px; font-weight: 600; font-size: 12px; border: 1px solid #dbeafe; }

/* Skip link */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: fixed;
  left: 16px;
  top: 16px;
  width: auto;
  height: auto;
  padding: 10px 14px;
  background: var(--brand-primary);
  color: #fff;
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  z-index: 100;
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
    --bg: #0b1220;
    --bg-muted: #0f172a;
    --border: #1f2937;
    --brand-primary: #60a5fa;
    --brand-primary-600: #3b82f6;
  }
  .site-header { background: rgba(15, 23, 42, 0.6); border-bottom-color: var(--border); }
  .button.ghost { background: rgba(17,24,39,0.6); border-color: rgba(31,41,55,0.9); color: var(--text-primary); backdrop-filter: saturate(160%) blur(8px); box-shadow: var(--shadow-sm); }
  .button.ghost:hover { background: rgba(17,24,39,0.78); }
  .card { background: rgba(15,23,42,0.65); backdrop-filter: saturate(160%) blur(10px); border-color: rgba(31,41,55,0.9); }
  .site-footer { background: #0f172a; border-top-color: var(--border); }
  .badge { background: rgba(59,130,246,.15); color: #bfdbfe; border-color: rgba(59,130,246,.3); }
}

