/* ============================================================
   TIANYI POWER — Common Styles
   河北天一锂能新能源有限公司 品牌官网
   共享于: index.html / product-*.html / cases.html / case-*.html
   ============================================================ */

/* ============================================================
   0. CSS Reset & Base
   ============================================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  font-family: var(--font-body);
  color: var(--color-text-primary);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { text-decoration: none; color: inherit; }
ul { list-style: none; }
button { border: none; background: none; cursor: pointer; font-family: inherit; }
input, textarea { font-family: inherit; }
button, a, input, textarea, select {
  touch-action: manipulation;
}

/* ============================================================
   1. Design Tokens (CSS Variables) — Light Mode
   ============================================================ */
:root {
  /* Brand Primary */
  --color-primary-deep: #0A2E5C;
  --color-primary: #123B6E;
  --color-primary-hover: #164B8A;
  --color-primary-active: #0D2F58;
  --color-primary-light: #1A73E8;
  --color-primary-light-hover: #1565D8;
  --color-primary-subtle: #E8F0FE;
  --color-primary-ghost: rgba(26, 115, 232, 0.08);

  /* Accent - Green Energy */
  --color-accent: #00BFA5;
  --color-accent-hover: #00A890;
  --color-accent-active: #00917C;
  --color-accent-subtle: #E0F7F5;
  --color-accent-dark: #007A66;

  /* Neutral */
  --color-white: #FFFFFF;
  --color-bg: #FFFFFF;
  --color-bg-alt: #F5F7FA;
  --color-bg-elevated: #F0F2F5;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F8F9FB;
  --color-border: #E2E5EA;
  --color-border-light: #EDEFF2;
  --color-border-hover: #C8CDD5;
  --color-divider: #E8EAEE;

  /* Text */
  --color-text-primary: #1A1A2E;
  --color-text-secondary: #4A4A5E;
  --color-text-tertiary: #8A8A9E;
  --color-text-placeholder: #AAAABC;
  --color-text-on-primary: #FFFFFF;
  --color-text-on-accent: #FFFFFF;
  --color-text-inverse: #FFFFFF;

  /* Semantic */
  --color-success: #10B981;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #3B82F6;

  /* Typography */
  --font-heading: 'Inter', -apple-system, BlinkMacSystemFont, 'Noto Sans SC', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Noto Sans SC', sans-serif;

  /* Spacing (4px grid) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-base: 16px;
  --space-lg: 20px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 40px;
  --space-4xl: 48px;
  --space-5xl: 64px;
  --space-6xl: 80px;
  --space-7xl: 96px;
  --space-8xl: 128px;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-2xl: 16px;
  --radius-full: 50%;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(10, 46, 92, 0.08);
  --shadow-md: 0 2px 8px rgba(10, 46, 92, 0.08), 0 1px 4px rgba(10, 46, 92, 0.04);
  --shadow-lg: 0 4px 16px rgba(10, 46, 92, 0.10), 0 2px 8px rgba(10, 46, 92, 0.06);
  --shadow-xl: 0 8px 32px rgba(10, 46, 92, 0.12), 0 4px 16px rgba(10, 46, 92, 0.08);
  --shadow-2xl: 0 12px 48px rgba(10, 46, 92, 0.16);

  /* Z-index */
  --z-base: 0;
  --z-overlay: 10;
  --z-sticky: 100;
  --z-dropdown: 200;
  --z-modal-backdrop: 300;
  --z-modal: 400;
}

/* ============================================================
   1b. Design Tokens — Dark Mode Override
   ============================================================ */
[data-theme="dark"] {
  --color-primary-deep: #162D50;
  --color-primary: #1A3A6A;
  --color-primary-hover: #1F4B8A;
  --color-primary-active: #122848;
  --color-primary-light: #3B8AFF;
  --color-primary-subtle: #1A2A44;
  --color-primary-ghost: rgba(59, 138, 255, 0.08);

  --color-bg: #0D1117;
  --color-bg-alt: #161B22;
  --color-bg-elevated: #1C2333;
  --color-surface: #161B22;
  --color-surface-hover: #1C2333;
  --color-border: #30363D;
  --color-border-light: #21262D;
  --color-border-hover: #484F58;
  --color-divider: #21262D;

  --color-text-primary: #E6EDF3;
  --color-text-secondary: #8B949E;
  --color-text-tertiary: #6E7681;
  --color-text-placeholder: #484F58;
  --color-text-on-primary: #E6EDF3;
  --color-text-inverse: #E6EDF3;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 2px 8px rgba(0, 0, 0, 0.3), 0 1px 4px rgba(0, 0, 0, 0.2);
  --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 8px 32px rgba(0, 0, 0, 0.5), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-2xl: 0 12px 48px rgba(0, 0, 0, 0.6);
}

/* ============================================================
   2. Typography System
   ============================================================ */
.display {
  font-family: var(--font-heading);
  font-size: 56px;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
}
.display-small {
  font-family: var(--font-heading);
  font-size: 44px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.015em;
}
.h1 {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.h2 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.005em;
}
.h3 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.35;
}
.h4 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}
.body-large {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 400;
  line-height: 1.65;
}
.body {
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.65;
}
.body-small {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
}
.caption {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.01em;
}
.small {
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

/* ============================================================
   3. Layout System
   ============================================================ */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}
.section {
  padding: var(--space-7xl) 0;
}
.section-alt {
  background: var(--color-bg-alt);
}
.section-dark {
  background: var(--color-primary-deep);
  color: var(--color-text-inverse);
}
.section-title {
  text-align: center;
  margin-bottom: var(--space-5xl);
}
.section-title .h2 {
  margin-bottom: var(--space-base);
}
.section-title .subtitle {
  color: var(--color-text-secondary);
  max-width: 600px;
  margin: 0 auto;
}
.section-dark .section-title .subtitle {
  color: rgba(255, 255, 255, 0.7);
}

/* ============================================================
   4. Header & Navigation
   ============================================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  height: 72px;
  background: rgba(10, 46, 92, 0.98);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.header.scrolled {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-xl);
}
.logo {
  display: flex;
  align-items: center;
}
.logo img {
  height: 40px;
  width: auto;
  display: block;
  transition: opacity 0.2s ease;
}
.logo:hover img {
  opacity: 0.85;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.nav-links a {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease;
  position: relative;
  white-space: nowrap;
}
.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--color-accent);
}
.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 60%;
  height: 2px;
  background: var(--color-accent);
  border-radius: 1px;
  transition: transform 0.25s ease;
}
.nav-links a:hover::after {
  transform: translateX(-50%) scaleX(1);
}
.nav-cta {
  margin-left: var(--space-lg);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: var(--space-sm);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.2s ease;
  color: rgba(255, 255, 255, 0.85);
  font-size: 18px;
  line-height: 1;
}
.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.18);
}
.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Hamburger */
.hamburger {
  display: none;
  width: 44px;
  height: 44px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}
.hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-white);
  border-radius: 2px;
  position: relative;
  transition: background 0.2s ease;
}
.hamburger span::before,
.hamburger span::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--color-white);
  border-radius: 2px;
  transition: transform 0.3s ease, top 0.3s ease;
}
.hamburger span::before { top: -7px; }
.hamburger span::after { top: 7px; }
.hamburger.active span { background: transparent; }
.hamburger.active span::before {
  top: 0;
  transform: rotate(45deg);
}
.hamburger.active span::after {
  top: 0;
  transform: rotate(-45deg);
}

/* Mobile Menu Overlay */
.mobile-menu {
  display: none;
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-primary-deep);
  z-index: var(--z-dropdown);
  padding: var(--space-2xl) var(--space-xl);
  flex-direction: column;
  gap: var(--space-xs);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.mobile-menu.open {
  opacity: 1;
  transform: translateY(0);
}
.mobile-menu a {
  display: flex;
  align-items: center;
  height: 56px;
  font-size: 16px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  padding: 0 var(--space-base);
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease;
}
.mobile-menu a:hover,
.mobile-menu a:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-accent);
}
.mobile-menu .mobile-cta {
  margin-top: var(--space-xl);
}
.mobile-menu .btn-accent {
  width: 100%;
  height: 48px;
  font-size: 16px;
}

/* ============================================================
   5. Buttons
   ============================================================ */
.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  padding: 10px 24px;
  border-radius: var(--radius-md);
  border: none;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  height: 40px;
}
.btn-accent:hover,
.btn-accent:focus-visible {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}
.btn-accent:active {
  background: var(--color-accent-active);
}
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-deep);
  color: var(--color-text-on-primary);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  padding: 12px 28px;
  border-radius: var(--radius-md);
  border: none;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  height: 44px;
  box-shadow: 0 1px 3px rgba(10, 46, 92, 0.2);
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--color-primary-hover);
  transform: translateY(-1px);
}
.btn-primary:active {
  background: var(--color-primary-active);
}
.btn-accent-lg {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-accent);
  color: var(--color-text-on-accent);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  padding: 14px 36px;
  border-radius: var(--radius-md);
  border: none;
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  height: 52px;
}
.btn-accent-lg:hover,
.btn-accent-lg:focus-visible {
  background: var(--color-accent-hover);
  transform: translateY(-1px);
}
.btn-accent-lg:active {
  background: var(--color-accent-active);
}
.btn-outline-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--color-white);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  padding: 14px 36px;
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s ease;
  cursor: pointer;
  white-space: nowrap;
  height: 52px;
}
.btn-outline-light:hover,
.btn-outline-light:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
  transform: translateY(-1px);
}
.btn-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-primary-light);
  transition: all 0.2s ease;
  cursor: pointer;
}
.btn-link:hover {
  color: var(--color-primary-light-hover);
}
.btn-link svg {
  transition: transform 0.2s ease;
}
.btn-link:hover svg {
  transform: translateX(4px);
}

/* ============================================================
   6. Footer
   ============================================================ */
.footer {
  background: var(--color-primary-deep);
  color: var(--color-text-inverse);
  padding: var(--space-5xl) 0 var(--space-2xl);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-3xl);
  margin-bottom: var(--space-4xl);
}
.footer-logo {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-base);
}
.footer-logo img {
  height: 32px;
  width: auto;
}
.footer-section .h4 {
  color: var(--color-white);
  margin-bottom: var(--space-lg);
}
.footer-section p {
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  line-height: 1.7;
}
.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.footer-links a {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.6);
  transition: color 0.2s ease;
}
.footer-links a:hover {
  color: var(--color-accent);
}
.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: var(--space-xl);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-base);
}
.footer-bottom .small {
  color: rgba(255, 255, 255, 0.4);
}

/* ============================================================
   7. Scroll Reveal Animation
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}
.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   8. Accessibility
   ============================================================ */
/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* High Contrast */
@media (prefers-contrast: high) {
  :root {
    --color-text-secondary: #000000;
    --color-border: #666666;
  }
}

/* Focus Indicator */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

/* Screen Reader Only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* ============================================================
   9. Responsive — Shared Breakpoints
   ============================================================ */
@media (max-width: 900px) {
  .nav-links, .nav-cta {
    display: none;
  }
  .hamburger {
    display: flex;
  }
  .mobile-menu {
    display: flex;
  }
}

@media (max-width: 640px) {
  .header {
    height: 60px;
  }
  .mobile-menu {
    top: 60px;
  }
  .section {
    padding: var(--space-4xl) 0;
  }
  .display {
    font-size: 28px;
  }
  .display-small {
    font-size: 24px;
  }
  .h1 {
    font-size: 22px;
  }
  .h2 {
    font-size: 20px;
  }
  .h3 {
    font-size: 17px;
  }
  .body-large {
    font-size: 16px;
  }
  .body {
    font-size: 15px;
  }
  .container {
    padding: 0 var(--space-base);
  }
  .footer-grid {
    grid-template-columns: 1fr;
    gap: var(--space-xl);
  }
  .footer-bottom {
    flex-direction: column;
    text-align: center;
    gap: var(--space-sm);
  }
  .btn-accent-lg {
    height: 48px;
    font-size: 15px;
  }
  .btn-primary,
  .btn-accent {
    min-height: 44px;
  }
  .footer-links a {
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
}

@media (max-width: 375px) {
  .section {
    padding: var(--space-3xl) 0;
  }
}
