/* ============================================
   恆基工程 — Heng Ki Engineering
   Palette: Navy + Steel (light, professional)
   No-Slop-UI: clean, restrained, functional
   ============================================ */

:root {
  /* Navy + Steel palette */
  --bg: #f7f8fa;
  --surface: #ffffff;
  --navy-900: #0f2347;
  --navy-800: #152b59;
  --navy-700: #1a3668;
  --navy-600: #204478;
  --primary: #1a3668;
  --primary-light: #204478;
  --primary-dark: #0f2347;
  --steel: #576c87;
  --steel-light: #7d91a8;
  --steel-dark: #3d4f64;
  --accent: #c8923a;
  --accent-light: #daa855;
  --text: #1a202c;
  --text-secondary: #4a5568;
  --text-muted: #718096;
  --border: #e2e8f0;
  --border-light: #edf2f7;
  --border-focus: #1a3668;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
  --transition: 200ms ease;
  --font: 'Noto Sans TC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================
   Base
   ============================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  color: var(--navy-800);
  line-height: 1.35;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--navy-900); }

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

/* ============================================
   Page Transition (fade 0.3s)
   ============================================ */
.page-transition {
  animation: pageFadeIn 0.3s ease both;
}
@keyframes pageFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================
   Navbar
   ============================================ */
.navbar {
  background: var(--navy-900);
  padding: 0 1.5rem;
  min-height: 64px;
  border-bottom: 2px solid var(--accent);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.2rem;
  color: #fff !important;
  letter-spacing: 0.02em;
}

.navbar .nav-link {
  color: rgba(255,255,255,0.85) !important;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 1rem !important;
  transition: color var(--transition), background var(--transition);
  border-radius: var(--radius);
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
  color: #fff !important;
  background: rgba(255,255,255,0.1);
}

.navbar .btn-accent {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.navbar .btn-accent:hover {
  background: var(--accent-light);
  color: #fff;
}

.navbar-toggler {
  border-color: rgba(255,255,255,0.3);
}
.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.85)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* ============================================
   Hero
   ============================================ */
.hero {
  position: relative;
  min-height: 85vh;
  display: flex;
  align-items: center;
  background: var(--navy-900);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.35;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(15,35,71,0.85) 0%, rgba(15,35,71,0.6) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  padding: 4rem 0;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  margin-bottom: 1.25rem;
}

.hero-title .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  animation: heroWordIn 0.6s ease forwards;
}

.hero-title .word:nth-child(1) { animation-delay: 0.1s; }
.hero-title .word:nth-child(2) { animation-delay: 0.2s; }
.hero-title .word:nth-child(3) { animation-delay: 0.3s; }
.hero-title .word:nth-child(4) { animation-delay: 0.4s; }
.hero-title .word:nth-child(5) { animation-delay: 0.5s; }
.hero-title .word:nth-child(6) { animation-delay: 0.6s; }
.hero-title .word:nth-child(7) { animation-delay: 0.7s; }
.hero-title .word:nth-child(8) { animation-delay: 0.8s; }
.hero-title .word:nth-child(9) { animation-delay: 0.9s; }
.hero-title .word:nth-child(10) { animation-delay: 1.0s; }

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

.hero-subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: rgba(255,255,255,0.8);
  max-width: 600px;
  margin-bottom: 2rem;
  line-height: 1.7;
}

.hero-cta .btn-primary-cta {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 0.75rem 2rem;
  border-radius: var(--radius);
  font-size: 1rem;
  transition: background var(--transition), box-shadow var(--transition);
}
.hero-cta .btn-primary-cta:hover {
  background: var(--accent-light);
  box-shadow: var(--shadow-hover);
}

.hero-cta .btn-outline-cta {
  background: transparent;
  color: #fff;
  border: 2px solid rgba(255,255,255,0.5);
  font-weight: 600;
  padding: 0.75rem 2rem;
  border-radius: var(--radius);
  font-size: 1rem;
  transition: border-color var(--transition), background var(--transition);
}
.hero-cta .btn-outline-cta:hover {
  border-color: #fff;
  background: rgba(255,255,255,0.1);
}

/* ============================================
   Section Headings
   ============================================ */
.section-heading {
  margin-bottom: 3rem;
}

.section-heading h2 {
  font-size: 2rem;
  color: var(--navy-800);
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.section-heading p {
  color: var(--text-secondary);
  font-size: 1.05rem;
}

.section-accent-line {
  width: 48px;
  height: 3px;
  background: var(--accent);
  margin: 0 auto 1rem;
  border-radius: 2px;
}

/* ============================================
   IntersectionObserver Fade-Slide (scroll trigger)
   ============================================ */
.fade-slide {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

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

/* stagger children of a .fade-stagger parent */
.fade-stagger > .stagger-item {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.fade-stagger.visible > .stagger-item:nth-child(1) { transition-delay: 0s; }
.fade-stagger.visible > .stagger-item:nth-child(2) { transition-delay: 0.1s; }
.fade-stagger.visible > .stagger-item:nth-child(3) { transition-delay: 0.2s; }
.fade-stagger.visible > .stagger-item:nth-child(4) { transition-delay: 0.3s; }
.fade-stagger.visible > .stagger-item:nth-child(5) { transition-delay: 0.4s; }
.fade-stagger.visible > .stagger-item:nth-child(6) { transition-delay: 0.5s; }
.fade-stagger.visible > .stagger-item:nth-child(7) { transition-delay: 0.6s; }
.fade-stagger.visible > .stagger-item:nth-child(8) { transition-delay: 0.7s; }
.fade-stagger.visible > .stagger-item {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================
   Cards
   ============================================ */
.card-noslop {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

.card-noslop:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* Decorative border highlight on hover */
.card-noslop {
  position: relative;
  overflow: hidden;
}
.card-noslop::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}
.card-noslop:hover::before {
  transform: scaleX(1);
}

/* ============================================
   News Cards (index)
   ============================================ */
.news-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.news-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.news-card .news-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}
.news-card .news-body {
  padding: 1.25rem;
}
.news-card .news-date {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.news-card .news-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 0.5rem;
}
.news-card .news-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   Why Us / Stats
   ============================================ */
.why-us {
  background: var(--navy-900);
  color: #fff;
  padding: 5rem 0;
}

.why-us h2 {
  color: #fff;
}

.stat-item {
  text-align: center;
  padding: 1.5rem;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.7);
  margin-top: 0.5rem;
}

/* ============================================
   Mission
   ============================================ */
.mission-section {
  padding: 5rem 0;
}

.mission-text {
  font-size: 1.15rem;
  color: var(--text-secondary);
  line-height: 1.9;
  max-width: 720px;
  margin: 0 auto;
}

.quote-mark {
  font-size: 3rem;
  color: var(--accent);
  line-height: 1;
  font-family: Georgia, serif;
}

/* ============================================
   Service Cards (6-card grid)
   ============================================ */
.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition);
  position: relative;
  overflow: hidden;
}
.service-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}
.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--transition);
}
.service-card:hover::before {
  transform: scaleX(1);
}

.service-icon {
  width: 56px;
  height: 56px;
  background: rgba(26,54,104,0.08);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  font-size: 1.5rem;
  color: var(--primary);
}

.service-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 0.5rem;
}

.service-card p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ============================================
   Partner Slider
   ============================================ */
.partners-section {
  padding: 4rem 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.partner-track {
  display: flex;
  gap: 3rem;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.partner-item {
  font-weight: 700;
  font-size: 1rem;
  color: var(--steel);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.65;
  transition: opacity var(--transition), color var(--transition);
}
.partner-item:hover {
  opacity: 1;
  color: var(--primary);
}

/* ============================================
   Contact Strip / Footer
   ============================================ */
.contact-strip {
  background: var(--navy-800);
  color: rgba(255,255,255,0.85);
  padding: 4rem 0 2rem;
}

.contact-strip h4 {
  color: #fff;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.contact-strip p, .contact-strip a {
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  line-height: 1.8;
}
.contact-strip a:hover {
  color: var(--accent-light);
}

.contact-strip .footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.1);
  margin-top: 2rem;
  padding-top: 1.5rem;
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
}

/* ============================================
   Gallery Zoom (hover zoom 1.02)
   ============================================ */
.gallery-zoom {
  overflow: hidden;
  border-radius: var(--radius);
}

.gallery-zoom img {
  transition: transform 0.4s ease;
}

.gallery-zoom:hover img {
  transform: scale(1.02);
}

/* ============================================
   Team Profiles (about)
   ============================================ */
.team-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0;
  overflow: hidden;
  text-align: center;
  transition: transform var(--transition), box-shadow var(--transition);
}
.team-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.team-card .team-img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.team-card .team-body {
  padding: 1.5rem;
}

.team-card .team-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 0.25rem;
}

.team-card .team-title {
  font-size: 0.85rem;
  color: var(--steel);
  margin-bottom: 0.75rem;
}

.team-card .team-bio {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ============================================
   Service Detail (services page)
   ============================================ */
.service-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
  margin-bottom: 1.5rem;
  transition: transform var(--transition), box-shadow var(--transition);
}
.service-detail:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.service-detail .service-num {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.05em;
}

.service-detail h3 {
  font-size: 1.3rem;
  margin: 0.5rem 0;
}

.service-detail .price-tag {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

/* ============================================
   Blog Cards (blog page)
   ============================================ */
.blog-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.blog-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.blog-card .blog-img {
  width: 100%;
  height: 220px;
  object-fit: cover;
}

.blog-card .blog-body {
  padding: 1.5rem;
}

.blog-card .blog-category {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.blog-card .blog-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 0.5rem;
}

.blog-card .blog-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.blog-card .blog-excerpt {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* Pagination */
.pagination .page-link {
  color: var(--primary);
  border-color: var(--border);
  border-radius: var(--radius) !important;
  margin: 0 2px;
  transition: background var(--transition), color var(--transition);
}
.pagination .page-link:hover {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pagination .active .page-link {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ============================================
   Contact Form (contact page)
   ============================================ */
.contact-form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2.5rem;
}

.contact-form-card .form-label {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.contact-form-card .form-control {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.65rem 0.9rem;
  font-size: 0.95rem;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.contact-form-card .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,54,104,0.12);
  outline: none;
}

.contact-form-card .btn-submit {
  background: var(--accent);
  color: #fff;
  border: none;
  font-weight: 700;
  padding: 0.7rem 2rem;
  border-radius: var(--radius);
  transition: background var(--transition);
}
.contact-form-card .btn-submit:hover {
  background: var(--accent-light);
}

/* Info box */
.contact-info-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.contact-info-block .info-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}

.contact-info-block .info-value {
  font-size: 0.95rem;
  color: var(--text);
}

.map-placeholder {
  background: var(--border-light);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  height: 350px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ============================================
   Page Header (inner pages)
   ============================================ */
.page-header {
  background: var(--navy-900);
  padding: 5rem 0 3rem;
  color: #fff;
  position: relative;
}

.page-header .breadcrumb {
  margin-bottom: 0.5rem;
}
.page-header .breadcrumb-item a {
  color: rgba(255,255,255,0.65);
}
.page-header .breadcrumb-item.active {
  color: rgba(255,255,255,0.9);
}
.page-header .breadcrumb-item+.breadcrumb-item::before {
  color: rgba(255,255,255,0.4);
}

.page-header h1 {
  color: #fff;
  font-size: 2.5rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
}

.page-header p {
  color: rgba(255,255,255,0.7);
  font-size: 1.1rem;
  margin: 0;
}

/* ============================================
   Story Timeline (about page)
   ============================================ */
.story-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2rem;
}

.story-block .story-year {
  font-size: 1rem;
  color: var(--accent);
  font-weight: 800;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
  .hero { min-height: 70vh; }
  .hero-title { font-size: 1.75rem; }
  .hero-subtitle { font-size: 0.95rem; }

  .page-header { padding: 3rem 0 2rem; }
  .page-header h1 { font-size: 1.75rem; }

  .contact-form-card { padding: 1.5rem; }

  .navbar .btn-accent { margin-top: 0.5rem; }

  .section-heading h2 { font-size: 1.5rem; }
}
