/* Main Styles for JJD Law Website */
:root {
  --font-family-sora: 'Sora', sans-serif;
  --font-family-inter: 'Inter', sans-serif;
  --primary-color: #191919;
  --secondary-color: #EDEBE8;
  --background-color: #F9FAFB;
  --text-dark: #111827;
  --text-light: #C7CAC1;
  --accent-color: #1B1B1B;
  --border-radius: 10px;
  --text-rgb-17-24-39: rgba(17, 24, 39, 1);
  --text-rgb-126-130-139: rgba(126, 130, 139, 1);
  --text-rgb-25-25-25: rgba(25, 25, 25, 1);
  --text-black: rgba(0, 0, 0, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-sora);
  background-color: white !important;
  color: var(--primary-color);
  line-height: 1.6;
  overflow-x: hidden;
}

html {
  scroll-behavior: smooth;
}

.container {
  width: 100%;
  max-width: 1707px;
  margin: 0 auto;
  position: relative;
  background: none !important;
}

/* Header Section */
.hero-section {
  width: 100%;
  height: 700px;
  position: relative;
  background-size: cover;
  background-position: center;
  /* WebP with JPG fallback */
  background-image: url('/images/background_1_1707x876.jpg');
  background-image: image-set(url('/images/background_1_1707x876.webp') type('image/webp'),
      url('/images/background_1_1707x876.jpg') type('image/jpeg'));
}

.hero-content {
  width: 1080px;
  height: 100%;
  margin: 0 auto;
  position: relative;
  padding-top: 40px;
}

.hero-text {
  width: 1080px;
  position: absolute;
  top: 200px;
  display: flex;
  flex-direction: column;
}

.main-heading {
  width: 471px;
  font-size: 45px;
  font-weight: 600;
  line-height: 60px;
  text-transform: capitalize;
  color: var(--text-dark);
  margin-bottom: 20px;
}

.subtitle {
  width: 407px;
  font-family: var(--font-family-inter);
  font-size: 12.36px;
  font-weight: 300;
  line-height: 19.60px;
  color: var(--primary-color);
  margin-top: 18.5px;
  margin-left: 471px;
}

/* Navigation */
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}

.logo {
  font-size: 20px;
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--primary-color);
  cursor: pointer;
  display: inline-block;
}

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

.nav-link {
  font-family: var(--font-family-inter);
  font-size: 14px;
  text-decoration: none;
  color: var(--primary-color);
  position: relative;
  transition: all 0.3s ease;
  padding: 5px 0;
}

.nav-link:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-link:hover:after {
  width: 100%;
}

.nav-link:hover {
  color: var(--text-dark);
}

.contact-info {
  font-size: 14px;
  text-decoration: underline;
}

/* Button Styles */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 18px 28px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.3s ease;
}

.button-outline {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  background: transparent;
}

.button-filled {
  background-color: var(--primary-color);
  color: var(--secondary-color);
  border: none;
}

.button-icon {
  margin-left: 10px;
}

/* 深藍色主要按鈕 */
.button-primary {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: #fff;
  border: none;
  box-shadow: 0 8px 20px rgba(30, 58, 138, 0.3);
}

.button-primary:hover {
  background: linear-gradient(135deg, #1e40af 0%, #2563eb 100%);
  box-shadow: 0 12px 28px rgba(30, 58, 138, 0.4);
  transform: translateY(-2px);
}

/* Image Gallery */
.image-gallery {
  width: 921px;
  height: 354px;
  position: absolute;
  top: 422px;
  display: flex;
  gap: 23px;
}

.gallery-item {
  overflow: hidden;
  border-radius: var(--border-radius);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dark Section */
.dark-section {
  width: 100%;
  height: 640px;
  background-color: var(--primary-color);
  position: relative;
  color: var(--secondary-color);
  background-size: cover;
  background-position: center;
  background-image: url('/images/background_1_1707x876.jpg');
}

.dark-overlay {
  width: 100%;
  height: 100%;
  position: absolute;
  background: rgba(0, 0, 0, 0.6);
}

.dark-content {
  width: 1080px;
  height: 100%;
  margin: 0 auto;
  position: relative;
  padding-top: 100px;
  z-index: 1;
}

.dark-heading {
  width: 445px;
  font-size: 35px;
  font-weight: 600;
  line-height: 50px;
  text-transform: capitalize;
  color: var(--text-light);
}

.dark-subtitle {
  width: 430px;
  font-family: var(--font-family-inter);
  font-size: 12.58px;
  font-weight: 300;
  line-height: 19.60px;
  color: var(--text-light);
  margin-top: 20px;
}

/* Card Styles */
.card-container {
  display: flex;
  justify-content: space-between;
  margin-top: 60px;
}

.card {
  width: 338px;
  height: 273px;
  background-color: var(--accent-color);
  border-radius: var(--border-radius);
  padding: 35px;
  color: var(--text-light);
}

.card-number {
  font-size: 30px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 42px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  text-transform: capitalize;
}

.card-text {
  font-family: var(--font-family-inter);
  font-size: 12.25px;
  font-weight: 300;
  line-height: 19.60px;
}

/* Business Section */
.business-section {
  width: 100%;
  height: 1007px;
  /* background: linear-gradient(0deg, var(--text-light) 15%, #F5F5F5 15%, #F5F5F5 15%); */
  position: relative;
}

.business-content {
  width: 1080px;
  height: 100%;
  margin: 0 auto;
  position: relative;
  padding-top: 100px;
}

.business-heading {
  font-size: 40px;
  font-weight: 600;
  line-height: 55px;
  text-transform: capitalize;
}

.business-heading-dark {
  color: var(--text-dark);
}

.business-heading-light {
  color: var(--text-rgb-126-130-139);
}

.divider {
  width: 100%;
  height: 1px;
  background-color: var(--text-light);
  margin: 30px 0;
}

.business-text {
  font-family: var(--font-family-inter);
  font-size: 12.25px;
  font-weight: 300;
  line-height: 19.60px;
  list-style: none;
  padding-left: 0;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.business-text li {
  position: relative;
  padding-left: 32px;
  margin-bottom: 12px;
}

/* 自訂打勾圖標 */
.business-text li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #191919;
  font-weight: bold;
  font-size: 16px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #E5E7EB;
  border-radius: 50%;
}

.business-image {
  width: 100%;
  height: 404px;
  border-radius: 20px;
  overflow: hidden;
  margin-top: 40px;
}

.business-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Achievements Section */
.achievements-section {
  width: 100%;
  height: 353px;
  background-color: transparent;
  position: relative;
}

.achievements-content {
  width: 1080px;
  height: 100%;
  margin: 0 auto;
  position: relative;
  text-align: center;
}

.achievements-heading {
  font-size: 35px;
  font-weight: 600;
  line-height: 42px;
  text-transform: capitalize;
  color: var(--text-dark);
  padding-top: 40px;
}

.achievements-subtitle {
  width: 585px;
  font-family: var(--font-family-inter);
  font-size: 12.25px;
  font-weight: 300;
  line-height: 19.60px;
  color: var(--primary-color);
  margin: 10px auto 40px;
}

.stats-container {
  width: 100%;
  height: 92px;
  border-top: 1px solid var(--primary-color);
  border-bottom: 1px solid var(--primary-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 30px;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 30px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 30px;
  color: var(--primary-color);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 12px;
  color: var(--primary-color);
  margin-top: 10px;
}

/* Case Studies Section */
.case-studies-section {
  width: 100%;
  height: 470px;
  background-color: var(--primary-color);
  position: relative;
}

.case-studies-content {
  width: 1080px;
  height: 100%;
  margin: 0 auto;
  position: relative;
  padding-top: 100px;
}

.case-studies-heading {
  font-size: 35px;
  font-weight: 600;
  line-height: 42px;
  text-transform: capitalize;
  color: var(--text-light);
  margin-bottom: 50px;
}

.testimonials-container {
  display: flex;
  overflow-x: auto;
  gap: 35px;
  padding-bottom: 20px;
  scrollbar-width: none;
  /* Firefox */
}

.testimonials-container::-webkit-scrollbar {
  display: none;
  /* Chrome, Safari, Edge */
}

.testimonial-item {
  width: 316px;
  min-width: 316px;
  border-top: 1px solid var(--text-light);
  padding-top: 20px;
}

.testimonial-text {
  font-family: var(--font-family-inter);
  font-size: 12.36px;
  font-weight: 300;
  line-height: 19.60px;
  color: var(--text-light);
  margin-bottom: 30px;
}

.testimonial-client {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 12px;
  color: var(--text-light);
}

/* Responsive Styles */
@media (max-width: 1200px) {

  .hero-content,
  .dark-content,
  .business-content,
  .achievements-content,
  .case-studies-content {
    width: 90%;
  }

  .hero-text,
  .image-gallery {
    width: 100%;
  }

  .main-heading,
  .subtitle {
    width: 100%;
    margin-left: 0;
  }

  .card-container {
    flex-wrap: wrap;
    gap: 20px;
  }

  .card {
    width: 48%;
  }
}

@media (max-width: 768px) {
  .hero-section {
    height: auto;
    padding: 50px 0;
  }

  .main-heading {
    font-size: 32px;
    line-height: 42px;
  }

  .nav-container {
    flex-direction: column;
    gap: 20px;
  }

  .image-gallery {
    flex-direction: column;
    height: auto;
  }

  .card {
    width: 100%;
  }

  .stats-container {
    flex-wrap: wrap;
    height: auto;
    padding: 20px 0;
  }

  .stat-item {
    width: 50%;
    margin-bottom: 20px;
  }
}

/* Fix for the w1920-light-1 class that was previously causing issues */
.w1920-light-1 {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
}

/* Footer Styles */
.footer {
  width: 100%;
  background-color: var(--primary-color);
  padding: 60px 0;
  color: var(--text-light);
}

.footer-content {
  width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.footer-logo {
  font-size: 20px;
  font-weight: 600;
  text-transform: uppercase;
}

.footer-links {
  display: flex;
  gap: 30px;
  margin: 20px 0;
}

.footer-link {
  font-family: var(--font-family-inter);
  font-size: 14px;
  text-decoration: none;
  color: var(--text-light);
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: var(--font-family-inter);
  font-size: 14px;
}

.footer-copyright {
  margin-top: 20px;
  font-family: var(--font-family-inter);
  font-size: 12px;
  color: var(--text-rgb-126-130-139);
}

@media (max-width: 1200px) {
  .footer-content {
    width: 90%;
  }
}

@media (max-width: 768px) {
  .footer-links {
    flex-direction: column;
    gap: 15px;
  }
}

/* Duplicate .dark-section and .card definitions removed - see lines 197-280 */

/* Header Styles */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.header-container {
  width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 0;
}

.main-nav {
  display: flex;
  align-items: center;
}

.header-contact {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Header Button Styles */
.header-contact .button-outline {
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.header-contact .button-outline:hover {
  background: rgba(25, 25, 25, 0.1);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Navigation */
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}

.logo {
  font-size: 20px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  color: var(--primary-color);
  text-decoration: none;
  cursor: pointer;
  display: inline-block;
  transition: opacity 0.3s ease;
}

.logo:hover {
  opacity: 0.8;
}

.nav-links {
  display: flex;
  gap: 30px;
}

.nav-link {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  color: var(--primary-color);
  position: relative;
  transition: all 0.3s ease;
  padding: 5px 0;
  margin: 0 5px;
}

.nav-link:after {
  content: '';
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-link:hover:after {
  width: 100%;
}

.nav-link:hover {
  color: var(--text-dark);
}

.contact-info {
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  background-color: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  transition: all 0.3s ease;
}

.contact-info:hover {
  background-color: rgba(0, 0, 0, 0.1);
}

.phone-icon {
  font-size: 16px;
}

/* Responsive Styles */
@media (max-width: 1200px) {

  .container,
  .hero-content,
  .dark-content {
    width: 90%;
  }

  .hero-text {
    width: 90%;
  }

  .main-heading,
  .subtitle {
    width: 100%;
    margin-left: 0;
  }

  .card-container {
    flex-direction: column;
    gap: 20px;
  }

  .card {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .hero-section {
    height: auto;
    padding: 50px 0;
  }

  .main-heading {
    font-size: 32px;
    line-height: 42px;
  }

  .nav-container {
    flex-direction: column;
    gap: 20px;
  }
}

/* Hero Section Adjustments */
body {
  padding-top: 0;
  /* Remove body padding to allow header to overlay hero section */
}

/* Enhanced Header Styles */
.site-header {
  padding: 10px 0;
  background-color: rgba(255, 255, 255, 0.7);
  /* More transparent background */
  backdrop-filter: blur(8px);
  /* Blur effect for better readability */
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.header-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

@media (max-width: 1200px) {
  .header-container {
    width: 90%;
    padding: 0;
  }
}

@media (max-width: 768px) {
  .site-header {
    position: sticky !important;
    top: 0;
    z-index: 1000;
    background-color: rgba(255, 255, 255, 0.95) !important;
  }

  .header-container {
    flex-direction: column;
    gap: 15px;
    padding: 10px 20px;
    align-items: center;
  }

  .logo {
    text-align: center;
  }

  .main-nav,
  .header-contact {
    width: 100%;
  }

  .nav-links {
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
  }

  .header-contact {
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
}

.hero-text .button-outline {
  display: inline-flex !important;
  width: auto !important;
  min-width: 0 !important;
  padding: 0 12px !important;
  justify-content: center !important;
  box-sizing: border-box !important;
}

/* ========================================
   Mobile Responsive Optimization
   ======================================== */

/* Desktop: Keep original fixed width behavior */
@media (min-width: 769px) {

  .hero-content,
  .dark-content,
  .business-content {
    width: 1080px;
    margin: 0 auto;
  }
}

/* Tablet and below: Use responsive width */
@media (max-width: 768px) {

  .hero-content,
  .dark-content,
  .business-content {
    max-width: 1080px;
    width: 100%;
    padding: 0 20px;
    margin: 0 auto;
    box-sizing: border-box;
  }
}

/* Phase 2-5: Mobile Specific Adjustments */
@media (max-width: 768px) {

  /* Hero Section - 設定固定高度讓背景圖有明確底部 */
  /* Hero Section - 加入底部白色遮罩 */
  .hero-section {
    height: 600px !important;
    /* 固定高度 */
    min-height: 600px !important;
    padding: 120px 0 0 0 !important;
    display: flex !important;
    flex-direction: column !important;
    background-size: cover !important;
    background-position: center bottom !important;
    /* 背景圖從底部對齊 */
    position: relative !important;
  }

  /* 白色遮罩覆蓋底部 */
  .hero-section::after {
    content: '' !important;
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 50px !important;
    /* 遮罩高度，可調整 */
    background: linear-gradient(to top, #ffffff 0%, rgba(255, 255, 255, 0.95) 50%, transparent 100%) !important;
    pointer-events: none !important;
    /* 不影響點擊 */
    z-index: 1 !important;
  }

  .hero-content {
    flex-direction: column !important;
    padding: 20px !important;
    gap: 20px !important;
    align-items: center !important;
    flex: 1 !important;
    display: flex !important;
    position: relative !important;
    z-index: 2 !important;
    /* 確保內容在遮罩上方 */
  }

  /* Hero 文字區塊 */
  .hero-content>div:first-child {
    max-width: 100% !important;
    text-align: center;
    flex-shrink: 0 !important;
    /* 不壓縮 */
  }

  /* Hero 圖片容器 - 填滿剩餘空間並貼底 */
  .hero-content>div:last-child {
    flex: 1 !important;
    display: flex !important;
    align-items: flex-end !important;
    /* 圖片貼齊底部 */
    justify-content: center !important;
    width: 100% !important;
    min-height: 0 !important;
    /* 允許壓縮 */
  }

  .hero-section picture,
  .hero-section img {
    max-width: 240px !important;
    /* 從 220px 增加到 280px */
    width: 100% !important;
    height: auto !important;
    display: block !important;
  }

  /* Hero Text */
  .main-heading {
    font-size: 28px !important;
    line-height: 38px !important;
    width: 100% !important;
  }

  .subtitle {
    display: none !important;
    /* 手機版隱藏英文副標題 */
  }

  /* Hero Button */
  .hero-section .button {
    font-size: 1.2rem !important;
    padding: 14px 32px !important;
  }

  .hero-section .button-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%) !important;
    box-shadow: 0 6px 16px rgba(30, 58, 138, 0.3) !important;
  }

  .hero-section .button-icon {
    font-size: 1.2rem !important;
  }

  /* License Section - Vertical Stacking */
  #license {
    padding: 60px 20px !important;
  }

  #license>div {
    flex-direction: column-reverse !important;
    /* 改為 column-reverse，圖片在下方 */
    gap: 32px !important;
    padding: 0 !important;
  }

  #license>div>div {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    /* 置中對齊 */
  }

  /* 標題置中 */
  #license>div>div>div:first-child {
    text-align: center !important;
  }

  /* 列表樣式優化 */
  #license .business-text {
    font-size: 14px !important;
    text-align: left !important;
    /* 列表內容左對齊 */
    max-width: 400px !important;
    margin: 0 auto !important;
    /* 列表容器置中 */
    padding-left: 0 !important;
    list-style: none !important;
  }

  #license .business-text li {
    position: relative !important;
    padding-left: 28px !important;
    margin-bottom: 12px !important;
  }

  /* 自訂圖標替換項目符號 */
  #license .business-text li::before {
    content: '✓' !important;
    position: absolute !important;
    left: 0 !important;
    color: #191919 !important;
    font-weight: bold !important;
    font-size: 16px !important;
    width: 20px !important;
    height: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #E5E7EB !important;
    border-radius: 50% !important;
  }

  #license img {
    width: 100% !important;
    max-width: 100% !important;
    transform: none !important;
  }

  /* About Section (專業背景) */
  #about {
    padding: 40px 20px !important;
  }

  #about>div {
    padding: 0 20px;
  }

  #about .business-heading-dark,
  #about .business-heading-light {
    font-size: 1.5rem !important;
  }

  /* Business Section */
  .business-section {
    height: auto !important;
    padding: 60px 0 !important;
  }

  .business-content {
    padding: 0 20px !important;
  }

  .business-heading {
    text-align: center !important;
  }

  .business-heading div:first-child {
    font-size: 1.75rem !important;
    line-height: 1.4 !important;
  }

  .business-heading div:last-child {
    font-size: 1rem !important;
    color: #7E828B !important;
  }

  .business-heading-dark {
    font-size: 1.8rem !important;
  }

  .business-heading-light {
    font-size: 1.2rem !important;
  }

  .business-text {
    font-size: 14px !important;
  }

  .business-image video {
    height: 250px !important;
  }

  /* Latest Articles Section */
  #latest-articles {
    padding: 40px 20px !important;
  }

  #latest-articles>div {
    padding: 0 !important;
  }

  #latest-articles>div>div:first-child {
    font-size: 1.75rem !important;
    /* 與其他標題一致 */
    line-height: 1.4 !important;
    margin-bottom: 32px !important;
  }

  /* Article Cards - Full Width */
  #latest-posts-container {
    gap: 24px !important;
  }

  #latest-posts-container>div {
    min-width: 100% !important;
    max-width: 100% !important;
    flex: none !important;
  }

  /* Footer */
  .footer {
    padding: 32px 20px !important;
  }

  .footer-content>div {
    flex-direction: column !important;
    gap: 20px !important;
  }

  .footer-logo {
    text-align: center;
  }

  .footer-contact {
    text-align: center;
  }

  /* General Mobile Adjustments */
  .container {
    padding: 0 !important;
  }

  /* Ensure no horizontal scroll */
  body {
    overflow-x: hidden;
  }

  * {
    max-width: 100%;
  }
}

/* Small Mobile Devices (iPhone SE, etc.) */
@media (max-width: 375px) {
  .main-heading {
    font-size: 24px !important;
    line-height: 34px !important;
  }

  .hero-section .button {
    font-size: 1rem !important;
    padding: 12px 24px !important;
  }

  #latest-articles h2,
  #latest-articles>div>div:first-child {
    font-size: 1.75rem !important;
  }
}