/*
Theme Name: 香港水喉維修專家
Description: 專業的香港水喉維修、通渠、防水工程及冷氣清洗服務WordPress主題
Author: 王師傅服務
Version: 1.0
Text Domain: hk-plumbing
*/

/* 引入移動端樣式 */
@import url("css/mobile.css");

/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #15803d;
  --secondary-color: #84cc16;
  --text-color: #374151;
  --bg-color: #ffffff;
  --light-bg: #f0fdf4;
  --border-color: #d1d5db;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --radius: 0.5rem;
  --header-height: 70px;
  --mobile-header-height: 60px;
}

body {
  font-family: "Microsoft JhengHei", "PingFang TC", "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: var(--bg-color);
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 1rem;
  color: var(--text-color);
}

h1 {
  font-size: 2.5rem;
}
h2 {
  font-size: 2rem;
}
h3 {
  font-size: 1.5rem;
}
h4 {
  font-size: 1.25rem;
}

p {
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -15px;
}

.col {
  flex: 1;
  padding: 0 15px;
}

.col-1 {
  flex: 0 0 8.333333%;
}
.col-2 {
  flex: 0 0 16.666667%;
}
.col-3 {
  flex: 0 0 25%;
}
.col-4 {
  flex: 0 0 33.333333%;
}
.col-6 {
  flex: 0 0 50%;
}
.col-8 {
  flex: 0 0 66.666667%;
}
.col-12 {
  flex: 0 0 100%;
}

/* Page Layout Enhancements */
.page-wrapper {
  min-height: calc(100vh - var(--header-height) - 200px);
}

.page-article {
  background: white;
}

.page-content-wrapper {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0;
  contain: layout style;
}

/* Hero Section for Pages */
.page-hero {
  display: flex;
  align-items: center;
  min-height: 500px;
  padding: 3rem 2rem;
  background: linear-gradient(135deg, var(--light-bg) 0%, #ffffff 100%);
  border-bottom: 1px solid var(--border-color);
  contain: layout style paint;
  will-change: auto;
}

.hero-content {
  flex: 1;
  padding-right: 3rem;
  animation: fadeInLeft 0.8s ease-out;
}

.hero-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  line-height: 1.2;
  text-wrap: balance;
}

.hero-subtitle {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-color);
  margin-bottom: 2rem;
  line-height: 1.6;
  text-wrap: pretty;
}

.hero-contact {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.hero-image {
  flex: 0 0 45%;
  text-align: center;
  animation: fadeInRight 0.8s ease-out;
}

.hero-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

/* Enhanced Content Sections with Better Typography */
.content-section {
  padding: 4rem 2rem;
  border-bottom: 1px solid var(--border-color);
  contain: layout style;
}

.content-section:nth-child(even) {
  background: var(--light-bg);
}

.section-content {
  display: flex;
  align-items: center;
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-text {
  flex: 1;
  font-size: 1.125rem;
  line-height: 1.7;
}

.section-image {
  flex: 0 0 45%;
}

.section-image img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  aspect-ratio: 4 / 3;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.section-image img:hover {
  transform: scale(1.02);
}

/* Reverse layout for alternating sections */
.content-section:nth-child(even) .section-content {
  flex-direction: row-reverse;
}

.section-title {
  font-size: clamp(1.5rem, 3vw, 2rem);
  color: var(--primary-color);
  margin-bottom: 1.5rem;
  font-weight: 700;
  text-wrap: balance;
}

.section-subtitle {
  font-size: clamp(1.125rem, 2vw, 1.25rem);
  color: var(--secondary-color);
  margin-bottom: 1rem;
  font-weight: 600;
  text-wrap: pretty;
}

/* Enhanced Keyword Highlighting with Better Colors */
.keyword {
  font-weight: 700;
  color: var(--primary-color);
  background: linear-gradient(120deg, rgba(21, 128, 61, 0.15) 0%, rgba(21, 128, 61, 0.1) 100%);
  padding: 0.2rem 0.4rem;
  border-radius: 0.25rem;
  border-bottom: 2px solid rgba(21, 128, 61, 0.3);
  text-decoration: none;
  transition: all 0.2s ease;
}

.keyword:hover {
  background: linear-gradient(120deg, rgba(21, 128, 61, 0.2) 0%, rgba(21, 128, 61, 0.15) 100%);
  border-bottom-color: var(--primary-color);
}

.highlight {
  background: linear-gradient(120deg, rgba(132, 204, 22, 0.25) 0%, rgba(132, 204, 22, 0.15) 100%);
  padding: 0.15rem 0.35rem;
  border-radius: 0.25rem;
  font-weight: 600;
  color: #365314;
  border-bottom: 1px solid rgba(132, 204, 22, 0.4);
  transition: all 0.2s ease;
}

.highlight:hover {
  background: linear-gradient(120deg, rgba(132, 204, 22, 0.3) 0%, rgba(132, 204, 22, 0.2) 100%);
}

/* Enhanced Service List with Better Visual Hierarchy */
.service-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
}

.service-list li {
  padding: 1.5rem;
  margin-bottom: 1rem;
  background: white;
  border-left: 4px solid var(--primary-color);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.service-list li::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  transition: width 0.3s ease;
}

.service-list li:hover {
  transform: translateX(8px);
  box-shadow: 0 4px 16px rgba(21, 128, 61, 0.15);
}

.service-list li:hover::before {
  width: 8px;
}

.service-list li strong {
  color: var(--primary-color);
  font-weight: 700;
  font-size: 1.125rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* Enhanced Features Grid with Better Spacing */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 2rem;
  margin: 3rem 0;
}

.feature-card {
  background: white;
  padding: 2.5rem 2rem;
  border-radius: var(--radius);
  text-align: center;
  border: 1px solid #e5f3e5;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.feature-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--secondary-color) 100%);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.feature-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(21, 128, 61, 0.12);
}

.feature-card:hover::before {
  transform: scaleX(1);
}

.feature-icon {
  font-size: 3rem;
  margin-bottom: 1.5rem;
  display: block;
  filter: grayscale(0.2);
  transition: filter 0.3s ease;
}

.feature-card:hover .feature-icon {
  filter: grayscale(0);
}

.feature-card h3 {
  color: var(--primary-color);
  font-size: 1.375rem;
  margin-bottom: 1rem;
  font-weight: 600;
  text-wrap: balance;
}

.feature-card p {
  color: var(--text-color);
  line-height: 1.7;
  font-size: 1.0625rem;
  text-wrap: pretty;
}

/* Contact CTA Section */
.contact-cta {
  background: linear-gradient(135deg, var(--primary-color) 0%, #166534 100%);
  color: white;
  padding: 4rem 2rem;
  text-align: center;
  margin: 3rem 0;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.contact-cta::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Ccircle cx='30' cy='30' r='2'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  pointer-events: none;
}

.contact-cta h3 {
  color: white;
  font-size: clamp(1.5rem, 3vw, 1.75rem);
  margin-bottom: 1rem;
  position: relative;
  z-index: 1;
  text-wrap: balance;
}

.contact-cta p {
  font-size: clamp(1rem, 2vw, 1.125rem);
  margin-bottom: 2rem;
  opacity: 0.95;
  position: relative;
  z-index: 1;
  text-wrap: pretty;
}

.contact-buttons {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.btn-white {
  background: white;
  color: var(--primary-color);
  padding: 1rem 2rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.0625rem;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.btn-white:hover {
  background: var(--light-bg);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  border-color: rgba(21, 128, 61, 0.2);
}

/* Header */
.site-header {
  background: var(--bg-color);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--header-height);
}

.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
  position: relative;
}

.hamburger {
  display: block;
  width: 24px;
  height: 18px;
  position: relative;
}

.hamburger span {
  display: block;
  height: 2px;
  width: 100%;
  background: var(--primary-color);
  border-radius: 1px;
  position: absolute;
  transition: all 0.3s ease;
}

.hamburger span:nth-child(1) {
  top: 0;
}

.hamburger span:nth-child(2) {
  top: 8px;
}

.hamburger span:nth-child(3) {
  top: 16px;
}

.mobile-menu-toggle.active .hamburger span:nth-child(1) {
  transform: rotate(45deg);
  top: 8px;
}

.mobile-menu-toggle.active .hamburger span:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle.active .hamburger span:nth-child(3) {
  transform: rotate(-45deg);
  top: 8px;
}

@media (max-width: 768px) {
  .site-header {
    height: var(--mobile-header-height);
  }

  .mobile-menu-toggle {
    display: block;
  }

  .main-nav {
    position: fixed;
    top: var(--mobile-header-height);
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    max-height: calc(100vh - var(--mobile-header-height));
    overflow-y: auto;
  }

  .main-nav.mobile-active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }

  .main-nav ul {
    flex-direction: column;
    padding: 1rem 0;
    gap: 0;
  }

  .main-nav li {
    border-bottom: 1px solid #f3f4f6;
  }

  .main-nav li:last-child {
    border-bottom: none;
  }

  .main-nav a {
    display: block;
    padding: 1rem 2rem;
    font-size: 1.125rem;
    font-weight: 500;
    transition: all 0.2s ease;
  }

  .main-nav a:hover {
    background: var(--light-bg);
    color: var(--primary-color);
    padding-left: 2.5rem;
  }

  .header-contact {
    display: none;
  }

  .header-content {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 0;
    padding: 0.75rem 0;
  }

  /* Prevent body scroll when menu is open */
  body.menu-open {
    overflow: hidden;
  }

  /* Mobile menu overlay */
  body.menu-open::before {
    content: "";
    position: fixed;
    top: var(--mobile-header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 1;
    visibility: visible;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 15px;
  }

  .hero-title {
    font-size: 1.75rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .section-title {
    font-size: 1.5rem;
  }

  .feature-card {
    padding: 1.5rem 1rem;
  }

  .contact-cta {
    padding: 2.5rem 1rem;
  }

  .btn-white {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
  }
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  text-decoration: none;
}

.main-nav ul {
  display: flex;
  list-style: none;
  gap: 2rem;
}

.main-nav a {
  text-decoration: none;
  color: var(--text-color);
  font-weight: 500;
  transition: color 0.3s;
}

.main-nav a:hover {
  color: var(--primary-color);
}

.cta-button {
  background: var(--primary-color);
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  transition: background 0.3s;
}

.cta-button:hover {
  background: #166534;
}

/* Services Section */
.services {
  padding: 4rem 0;
  background: var(--light-bg);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.service-card {
  background: white;
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-align: center;
  transition: transform 0.3s;
  will-change: transform;
  backface-visibility: hidden;
}

.service-card:hover {
  transform: translateY(-5px);
}

.service-icon {
  width: 60px;
  height: 60px;
  background: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
  color: white;
  font-size: 1.5rem;
}

/* Contact Section */
.contact {
  padding: 4rem 0;
}

.contact-info {
  background: var(--light-bg);
  padding: 2rem;
  border-radius: var(--radius);
  margin-bottom: 2rem;
}

.contact-item {
  display: flex;
  align-items: center;
  margin-bottom: 1rem;
}

.contact-item i {
  color: var(--primary-color);
  margin-right: 1rem;
  width: 20px;
}

/* Footer */
.site-footer {
  background: var(--text-color);
  color: white;
  padding: 3rem 0 1rem;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-section h3 {
  color: white;
  margin-bottom: 1rem;
}

.footer-section a {
  color: #d1d5db;
  text-decoration: none;
  display: block;
  margin-bottom: 0.5rem;
}

.footer-section a:hover {
  color: white;
}

.footer-bottom {
  border-top: 1px solid #4b5563;
  padding-top: 1rem;
  text-align: center;
  color: #9ca3af;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s;
  border: none;
  cursor: pointer;
  will-change: transform;
  backface-visibility: hidden;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
}

.btn-primary:hover {
  background: #166534;
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
}

.btn-secondary:hover {
  background: #65a30d;
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.form-control {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-size: 1rem;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
  }

  .main-nav ul {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

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

  .row {
    flex-direction: column;
  }

  .col-1,
  .col-2,
  .col-3,
  .col-4,
  .col-6,
  .col-8 {
    flex: 0 0 100%;
  }

  .page-hero {
    flex-direction: column;
    text-align: center;
    padding: 2rem 1rem;
    min-height: auto;
  }

  .hero-content {
    padding-right: 0;
    margin-bottom: 2rem;
  }

  .hero-image {
    flex: none;
    max-width: 100%;
  }

  .section-content {
    flex-direction: column !important;
    text-align: center;
    gap: 2rem;
  }

  .section-image {
    flex: none;
    max-width: 100%;
  }

  .features-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .feature-card {
    padding: 2rem 1.5rem;
  }

  .contact-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn-white {
    width: 100%;
    max-width: 280px;
  }

  .service-overview,
  .content-section {
    padding: 2rem 1rem;
  }

  .service-list li {
    padding: 1.25rem;
  }
}

/* Performance Optimizations */
/* 圖片優化 */
img {
  max-width: 100%;
  height: auto;
  loading: lazy;
  decoding: async;
}

/* 字體載入優化 */
@font-face {
  font-family: "Microsoft JhengHei";
  font-display: swap;
  font-weight: 400 700;
}

/* Optimize animations for performance */
@keyframes fadeInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .hero-content,
  .hero-image {
    animation: none;
  }

  .feature-card,
  .service-list li,
  .section-image img {
    transition: none;
  }
}

/* Accessibility */
a:focus,
button:focus,
input:focus,
textarea:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .site-header,
  .site-footer,
  .cta-button {
    display: none;
  }

  .hero-contact,
  .contact-cta {
    display: none;
  }

  .page-hero {
    background: white;
    border: 1px solid #ccc;
  }
}
