/* ========================================
   1STCHIP - 豐權佑電子有限公司
   Landing Page Stylesheet
   ======================================== */

/* --- CSS Variables --- */
:root {
  --color-primary: #1a56db;
  --color-primary-hover: #1e40af;
  --color-secondary: #2563eb;
  --color-accent-light: #dbeafe;
  --color-accent-bg: #eff6ff;
  --color-white: #ffffff;
  --color-bg-light: #f8fafc;
  --color-text-dark: #1e293b;
  --color-text-body: #334155;
  --color-text-muted: #64748b;
  --color-border: #e2e8f0;
  --color-border-light: #f1f5f9;

  --font-sans: 'Noto Sans TC', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Inter', 'SF Mono', monospace;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.1);
  --shadow-card-hover: 0 12px 40px rgba(26, 86, 219, 0.12);

  --transition-base: cubic-bezier(0.16, 1, 0.3, 1);
  --container-max: 1200px;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  color: var(--color-text-body);
  background: var(--color-white);
  line-height: 1.75;
  overflow-x: hidden;
}

a {
  text-decoration: none;
  color: inherit;
  transition: color 0.3s var(--transition-base);
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

/* --- Utility --- */
.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

.section-padding {
  padding: 100px 0;
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--color-text-dark);
  text-align: center;
  margin-bottom: 16px;
}

.section-subtitle {
  font-size: 1.05rem;
  color: var(--color-text-muted);
  text-align: center;
  max-width: 600px;
  margin: 0 auto 60px;
  line-height: 1.8;
}

/* --- Scroll Animation --- */
.fade-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s var(--transition-base), transform 0.7s var(--transition-base);
}

.fade-up.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========================================
   LANGUAGE TOGGLE
   ======================================== */
.lang-toggle {
  padding: 6px 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  background: transparent;
  color: var(--color-white);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.3s var(--transition-base);
  margin-left: 16px;
  letter-spacing: 0.5px;
}

.navbar.scrolled .lang-toggle {
  color: var(--color-text-dark);
  border-color: var(--color-border);
}

.lang-toggle:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
}

.navbar.scrolled .lang-toggle:hover {
  background: var(--color-bg-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.lang-toggle.en {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: var(--color-white);
}

.navbar.scrolled .lang-toggle.en {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-white);
}

/* Inline nav container for language toggle */
.inline-nav {
  display: inline-flex;
  align-items: center;
  gap: 32px;
}

.inline-nav a {
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
  padding: 4px 0;
  transition: color 0.3s var(--transition-base);
}

.navbar.scrolled .inline-nav a {
  color: var(--color-text-body);
}

.inline-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-secondary);
  transition: width 0.3s var(--transition-base);
  border-radius: 1px;
}

.inline-nav a:hover::after,
.inline-nav a.active::after {
  width: 100%;
}

.inline-nav a:hover {
  color: var(--color-white);
}

.navbar.scrolled .inline-nav a:hover {
  color: var(--color-primary);
}

@media (max-width: 768px) {
  .inline-nav {
    display: flex;
    flex-direction: column;
    gap: 24px;
  }
  .inline-nav a {
    font-size: 1.2rem;
    color: var(--color-white) !important;
  }
}

/* ========================================
   NAVIGATION
   ======================================== */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 16px 0;
  transition: all 0.4s var(--transition-base);
  background: transparent;
}

.navbar.scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.06);
  padding: 10px 0;
}

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

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.35rem;
  color: var(--color-white);
  transition: color 0.4s var(--transition-base);
}

.navbar.scrolled .nav-logo {
  color: var(--color-primary);
}

.nav-logo-icon {
  width: 36px;
  height: 36px;
  border: 2.5px solid currentColor;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  font-family: var(--font-mono);
  position: relative;
}

.nav-logo-icon::after {
  content: '';
  position: absolute;
  top: -4px;
  right: -4px;
  width: 8px;
  height: 8px;
  background: currentColor;
  border-radius: 50%;
  opacity: 0.6;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-links a {
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  position: relative;
  padding: 4px 0;
  transition: color 0.3s var(--transition-base);
}

.navbar.scrolled .nav-links a {
  color: var(--color-text-body);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--color-secondary);
  transition: width 0.3s var(--transition-base);
  border-radius: 1px;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

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

.navbar.scrolled .nav-links a:hover {
  color: var(--color-primary);
}

/* Mobile menu toggle */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 4px;
  background: none;
  border: none;
}

.nav-toggle span {
  width: 24px;
  height: 2px;
  background: var(--color-white);
  border-radius: 2px;
  transition: all 0.3s var(--transition-base);
}

.navbar.scrolled .nav-toggle span {
  background: var(--color-text-dark);
}

/* ========================================
   HERO SECTION
   ======================================== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  position: relative;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 40%, #1a56db 100%);
  overflow: hidden;
}

/* Circuit pattern background */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse at 70% 50%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at 70% 50%, black 30%, transparent 70%);
}

/* Decorative circuit nodes */
.hero::after {
  content: '';
  position: absolute;
  top: 20%;
  right: 10%;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(59, 130, 246, 0.15);
  border-radius: 50%;
  animation: pulse-ring 4s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.08); opacity: 0.6; }
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 100px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 28px;
  backdrop-filter: blur(4px);
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  background: #34d399;
  border-radius: 50%;
  animation: blink 2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  color: var(--color-white);
  line-height: 1.3;
  margin-bottom: 20px;
  letter-spacing: -0.5px;
}

.hero h1 .highlight {
  color: #60a5fa;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.8;
  margin-bottom: 40px;
  max-width: 560px;
}

.hero-buttons {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 0.3s var(--transition-base);
  border: none;
}

.btn-primary {
  background: var(--color-secondary);
  color: var(--color-white);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.5);
}

.btn-outline {
  background: transparent;
  color: var(--color-white);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

/* Hero stats cards */
.hero-stats {
  position: absolute;
  right: 5%;
  bottom: 15%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 2;
}

.hero-stat-card {
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  min-width: 180px;
  animation: float-in 0.8s var(--transition-base) both;
}

.hero-stat-card:nth-child(2) { animation-delay: 0.15s; }
.hero-stat-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes float-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.hero-stat-number {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--color-white);
  font-family: var(--font-mono);
}

.hero-stat-label {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.6);
  margin-top: 4px;
}

/* ========================================
   ABOUT SECTION
   ======================================== */
.about {
  background: var(--color-white);
}

/* ========================================
   ABOUT SECTION (Restructured)
   ======================================== */
.about {
  background: var(--color-white);
}

.about-intro {
  max-width: 800px;
  margin: 0 auto 50px;
  text-align: center;
}

.about-intro p {
  font-size: 1.05rem;
  color: var(--color-text-body);
  line-height: 1.9;
}

/* Subsection titles */
.about-subsection {
  margin-bottom: 50px;
}

.about-subsection-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-primary);
  text-align: center;
  margin-bottom: 32px;
  position: relative;
  display: inline-block;
  left: 50%;
  transform: translateX(-50%);
}

.about-subsection-title::after {
  content: '';
  display: block;
  width: 50px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  margin: 10px auto 0;
}

/* Core Services - 2x2 grid */
.about-services-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.about-service-card {
  background: var(--color-bg-light);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 28px 24px;
  display: flex;
  gap: 18px;
  align-items: flex-start;
  transition: all 0.3s var(--transition-base);
}

.about-service-card-body {
  flex: 1;
  min-width: 0;
}

.about-service-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-accent-light);
}

.about-service-icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  background: var(--color-accent-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  transition: all 0.3s var(--transition-base);
}

.about-service-card:hover .about-service-icon {
  background: var(--color-primary);
  color: var(--color-white);
}

.about-service-card h4,
.about-service-card-body h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text-dark);
  margin-bottom: 6px;
}

.about-service-card p,
.about-service-card-body p {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* Strengths - 3 column grid */
.about-strengths-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.about-strength-card {
  text-align: center;
  padding: 36px 28px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  background: var(--color-bg-light);
  transition: all 0.3s var(--transition-base);
}

.about-strength-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: var(--color-accent-light);
}

.about-strength-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px;
  background: var(--color-accent-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  transition: all 0.3s var(--transition-base);
}

.about-strength-card:hover .about-strength-icon {
  background: var(--color-primary);
  color: var(--color-white);
}

.about-strength-card h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-dark);
  margin-bottom: 8px;
}

.about-strength-card p {
  font-size: 0.88rem;
  color: var(--color-text-muted);
  line-height: 1.7;
}

/* Closing Statement */
.about-closing {
  max-width: 720px;
  margin: 50px auto 0;
  text-align: center;
  padding: 32px 40px;
  background: linear-gradient(135deg, var(--color-accent-bg), var(--color-white));
  border: 1px solid var(--color-accent-light);
  border-radius: var(--radius-lg);
  position: relative;
}

.about-closing::before {
  content: '"';
  position: absolute;
  top: -10px;
  left: 24px;
  font-size: 4rem;
  color: var(--color-primary);
  opacity: 0.15;
  font-family: Georgia, serif;
  line-height: 1;
}

.about-closing p {
  font-size: 1.05rem;
  color: var(--color-text-dark);
  font-weight: 500;
  line-height: 1.8;
}

.about-closing p.en {
  font-family: 'Inter', 'Noto Sans TC', sans-serif;
}

.english-card h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-dark);
  margin: 24px 0 8px;
  font-family: 'Inter', 'Noto Sans TC', sans-serif;
}

.english-card p {
  font-size: 0.95rem;
  color: var(--color-text-body);
  line-height: 1.8;
  margin-bottom: 12px;
}

.english-card ul {
  padding-left: 20px;
  margin-bottom: 16px;
}

.english-card ul li {
  font-size: 0.95rem;
  color: var(--color-text-body);
  line-height: 1.8;
  margin-bottom: 8px;
  list-style: disc;
  padding-left: 4px;
}

.english-card ul li strong {
  color: var(--color-text-dark);
  font-weight: 600;
}

/* ========================================
   CONTACT SECTION
   ======================================== */
.contact {
  background: var(--color-bg-light);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
}

.contact-info h3 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--color-text-dark);
  margin-bottom: 24px;
}

.contact-info-item {
  display: flex;
  gap: 16px;
  margin-bottom: 24px;
  align-items: flex-start;
}

.contact-info-icon {
  width: 40px;
  height: 40px;
  min-width: 40px;
  background: var(--color-accent-light);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.contact-info-item h4 {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.contact-info-item p {
  font-size: 0.95rem;
  color: var(--color-text-dark);
  font-weight: 500;
}



/* ========================================
   FOOTER
   ======================================== */
.footer {
  background: #0f172a;
  color: rgba(255, 255, 255, 0.6);
  padding: 60px 0 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-brand .nav-logo {
  color: var(--color-white);
  margin-bottom: 16px;
}

.footer-brand p {
  font-size: 0.9rem;
  line-height: 1.8;
  max-width: 320px;
}

.footer h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-white);
  margin-bottom: 16px;
}

.footer-links a {
  display: block;
  font-size: 0.88rem;
  color: rgba(255, 255, 255, 0.5);
  padding: 4px 0;
  transition: color 0.3s;
}

.footer-links a:hover {
  color: rgba(255, 255, 255, 0.9);
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 1024px) {
  .hero-stats {
    display: none;
  }
  
  .about-strengths-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

  .nav-links {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(12px);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 24px;
    z-index: 999;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-links a {
    font-size: 1.2rem;
    color: var(--color-white) !important;
  }

  .lang-toggle {
    margin-left: 0;
    margin-top: 12px;
    padding: 10px 24px;
    font-size: 1rem;
    color: var(--color-white) !important;
    border-color: rgba(255, 255, 255, 0.3) !important;
  }

  .lang-toggle.en {
    background: var(--color-secondary) !important;
    border-color: var(--color-secondary) !important;
    color: var(--color-white) !important;
  }

  .nav-toggle {
    display: flex;
    z-index: 1001;
  }

  .about-services-grid {
    grid-template-columns: 1fr;
  }

  .about-strengths-grid {
    grid-template-columns: 1fr 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .footer-bottom {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .hero-buttons {
    flex-direction: column;
  }

  .btn {
    justify-content: center;
  }

  }

@media (max-width: 480px) {
  .about-strengths-grid {
    grid-template-columns: 1fr;
  }

  .about-service-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

/* ============================================
   Language Visibility Control (MUST be last)
   ============================================ */

/* Default: hide all English content */
.en {
  display: none !important;
}

/* When English mode: hide Chinese, show English */
body.lang-en .zh {
  display: none !important;
}

body.lang-en .en {
  display: block !important;
}

/* Inline elements */
body.lang-en .inline-nav.en {
  display: inline-flex !important;
}

body.lang-en .inline-span.en {
  display: inline !important;
}

/* Service and strength cards */
body.lang-en .about-service-card .en {
  display: block !important;
}

body.lang-en .about-strength-card .en {
  display: block !important;
}

/* Ensure lang toggle button is always visible */
.lang-toggle {
  display: inline-flex !important;
}
