:root {
  /* Modern Palette */
  --primary-color: #4f46e5; /* Indigo 600 */
  --primary-dark: #3730a3; /* Indigo 800 */
  --primary-light: #e0e7ff; /* Indigo 100 */
  --secondary-color: #06b6d4; /* Cyan 500 */
  --accent-color: #f43f5e; /* Rose 500 */

  --text-color: #1e293b; /* Slate 800 */
  --text-light: #64748b; /* Slate 500 */

  --bg-body: #f8fafc; /* Slate 50 */
  --bg-white: #ffffff;
  --bg-gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);

  --blur-bg: rgba(255, 255, 255, 0.85);
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: 1px solid rgba(255, 255, 255, 0.5);

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 15px rgba(79, 70, 229, 0.4);

  --border-radius: 12px;
  --border-radius-lg: 20px;

  --font-main: "Prompt", sans-serif;
}

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

html,
body {
  overflow-x: hidden;
  width: 100%;
  position: relative;
}

body {
  font-family: var(--font-main);
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--bg-body);
}

main {
  padding-top: 100px; /* Offset for fixed header */
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-main);
  color: var(--primary-dark);
  margin-bottom: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

h1 {
  font-size: 3rem;
  letter-spacing: -1px;
}
h2 {
  font-size: 2.25rem;
  margin-bottom: 40px;
  position: relative;
  display: inline-block;
}
h2::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 0;
  width: 60px;
  height: 6px;
  background: var(--bg-gradient);
  border-radius: 3px;
}

h3 {
  font-size: 1.5rem;
  color: #1e293b;
}
p {
  margin-bottom: 1.5rem;
}

a {
  text-decoration: none;
  color: var(--primary-color);
  transition: all 0.3s ease;
}

ul {
  list-style: none;
}
img {
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: var(--border-radius);
}

.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  background-size: 200% auto;
  color: white;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Modern Bouncy Transition */
  text-align: center;
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

.btn:hover {
  color: white;
  background-position: right center; /* Gradient Animation */
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 25px rgba(6, 182, 212, 0.5); /* Cyan Glow Effect */
}

.btn-line {
  background: linear-gradient(135deg, #00b900 0%, #00d300 100%);
  box-shadow: 0 4px 15px rgba(0, 185, 0, 0.3);
  color: white !important;
}

.btn-line:hover {
  box-shadow: 0 10px 25px rgba(0, 185, 0, 0.5) !important;
  background-position: right center;
}

.btn-line-outline {
  border: 2px solid #00b900 !important;
  color: #00b900 !important;
  background: white !important;
  box-shadow: none !important;
}

.btn-line-outline:hover {
  background: #00b900 !important;
  color: white !important;
  box-shadow: 0 10px 20px rgba(0, 185, 0, 0.2) !important;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  background: white;
  color: var(--primary-color);
  border: 2px solid #e0e7ff; /* Soft border initially */
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
  transition: all 0.3s ease;
  text-align: center;
}

.btn-secondary:hover {
  border-color: var(--primary-color);
  background: #f8fafc;
  color: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(79, 70, 229, 0.15);
}

/* --- Preloader --- */
#preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-white);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.5s ease;
}

.loader-content {
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--primary-light);
  border-top: 5px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

.loading-text {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary-color);
  letter-spacing: 2px;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* --- Header & Nav --- */
header {
  background: var(--blur-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
  padding: 20px 0;
  transition: all 0.3s ease;
}

header.scrolled {
  padding: 10px 0;
  box-shadow: var(--shadow);
}

nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--bg-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.nav-links li a {
  font-weight: 600;
  color: var(--text-color);
  position: relative;
  padding: 5px 0;
}

.nav-links li a::after {
  content: "";
  position: absolute;
  width: 0;
  height: 2px;
  bottom: 0;
  left: 0;
  background: var(--bg-gradient);
  transition: width 0.3s;
}

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

/* Header CTA Button - Special Styling */
.nav-links li a.btn-header-cta {
  background: linear-gradient(90deg, #ff3e3e, #ff8c42, #ff3e3e);
  background-size: 200% auto;
  color: white;
  padding: 10px 25px;
  border-radius: 50px;
  box-shadow: 0 4px 15px rgba(255, 62, 62, 0.4);
  animation: gradientMove 3s linear infinite;
  text-transform: uppercase;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

.nav-links li a.btn-header-cta::after {
  display: none; /* Remove the underline effect */
}

.nav-links li a.btn-header-cta:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 20px rgba(255, 62, 62, 0.6);
}

@keyframes gradientMove {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

.hamburger {
  display: none;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
  width: 32px;
  height: 22px;
  z-index: 1100;
}

.hamburger .line {
  width: 100%;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--primary-color),
    var(--secondary-color)
  );
  border-radius: 4px;
  transition: all 0.3s cubic-bezier(0.68, -0.6, 0.32, 1.6);
  transform-origin: center;
}

.hamburger.active .line:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
  background: var(--primary-color);
}

.hamburger.active .line:nth-child(2) {
  opacity: 0;
  transform: scale(0);
}

.hamburger.active .line:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
  background: var(--primary-color);
}

body.no-scroll {
  overflow: hidden;
  height: 100vh;
}

html.no-scroll {
  overflow: hidden;
  height: 100vh;
}

/* --- Hero Section --- */
.hero {
  position: relative;
  padding: 15px 0 60px; /* Reduced vertical padding */
  background: transparent;
  overflow: hidden;
}

/* Background Gradients/Shapes */
.hero::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 600px;
  height: 600px;
  background: radial-gradient(
    circle,
    rgba(6, 182, 212, 0.15) 0%,
    rgba(255, 255, 255, 0) 70%
  );
  border-radius: 50%;
  z-index: -1;
  animation: float 6s ease-in-out infinite;
}

.hero::after {
  content: "";
  position: absolute;
  bottom: -10%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(
    circle,
    rgba(79, 70, 229, 0.1) 0%,
    rgba(255, 255, 255, 0) 70%
  );
  border-radius: 50%;
  z-index: -1;
  animation: float 8s ease-in-out infinite reverse;
}

@keyframes float {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(20px, -20px);
  }
}

.hero-content {
  max-width: 100%;
  text-align: left;
  padding-right: 20px; /* Add breathing room between text and image */
}

.hero h1 {
  font-size: 2.8rem; /* Reduced from 3.5rem */
  line-height: 1.3;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800; /* Make it bolder but smaller */
}

.hero p {
  font-size: 1.1rem; /* Slightly smaller for better balance */
  color: var(--text-light);
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

/* Moved to index.css */

/* Portfolio Grid Images */
.portfolio-img-container {
  overflow: hidden;
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  height: 250px;
  position: relative;
}

.portfolio-img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.card:hover .portfolio-img-container img {
  transform: scale(1.05); /* Zoom effect on hover */
}

/* Moved to index.css */

/* --- Dark Section Theme --- */
.section-dark {
  background-color: #0f172a; /* Slate 900 */
  color: #e2e8f0;
  position: relative;
  z-index: 1;
}

/* Add subtle pattern overlay */
.section-dark::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(#334155 1px, transparent 1px);
  background-size: 30px 30px;
  opacity: 0.1;
  z-index: -1;
}

.section-dark h2 {
  color: white;
}
.section-dark h2::after {
  background: var(--secondary-color);
}
.section-dark h3 {
  color: var(--secondary-color);
}
.section-dark p {
  color: #cbd5e1;
}

/* Dark Card Style */
.section-dark .card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}
.section-dark .card:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--secondary-color);
  transform: translateY(-5px);
}

/* Dark List Styles */
.section-dark ul li,
.section-dark .check-list li {
  color: #e2e8f0;
}

/* --- Cards & Grid --- */
section {
  padding: 80px 0;
}

.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: 30px;
}

.grid-2 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  background: var(--bg-white);
  padding: 40px 30px;
  border-radius: var(--border-radius-lg);
  border: 1px solid rgba(0, 0, 0, 0.03);
  box-shadow: var(--shadow);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-10px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-light);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: var(--bg-gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.4s ease;
}

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

.card h3 {
  font-size: 1.4rem;
  margin-bottom: 15px;
}

/* Moved to services.css */

/* Portfolio */
.portfolio-item {
  padding: 20px;
}
.portfolio-item img {
  height: 220px;
  object-fit: cover;
  margin-bottom: 20px;
  transition: transform 0.5s ease;
}
.portfolio-item:hover img {
  transform: scale(1.03);
}

/* Moved to contact.css */

/* Price Tag */
.price-tag {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--primary-color);
  margin: 15px 0;
  font-family: var(--font-main);
  line-height: 1;
}

.price-tag span {
  font-size: 1rem;
  color: var(--text-light);
  font-weight: 500;
  margin-left: 5px;
}

/* Steps */
.step {
  text-align: center;
  padding: 30px;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease;
  border: 1px solid #f1f5f9;
}

.step:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow);
  border-color: var(--primary-light);
}

.step-number {
  width: 60px;
  height: 60px;
  line-height: 60px;
  margin: 0 auto 20px;
  background: var(--bg-gradient);
  color: white;
  font-size: 1.5rem;
  font-weight: 800;
  border-radius: 50%;
  box-shadow: var(--shadow-glow);
}

.step h4 {
  font-size: 1.25rem;
  margin-bottom: 10px;
}

.check-list {
  margin-top: 20px;
}

.check-list li {
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  color: var(--text-color);
}

/* --- Footer --- */
footer {
  background-color: #0f172a;
  color: #94a3b8;
  padding: 80px 0 30px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 50px;
  margin-bottom: 50px;
  border-bottom: 1px solid #334155;
  padding-bottom: 50px;
}

.footer-col h3 {
  color: white;
  margin-bottom: 25px;
}

.footer-links li a {
  color: #94a3b8;
  display: block;
  margin-bottom: 12px;
  transition: 0.3s;
}

.footer-links li a:hover {
  color: var(--secondary-color);
  padding-left: 8px;
}

.social-links a {
  display: inline-flex;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  margin-right: 10px;
  transition: 0.3s;
}

.social-links a:hover {
  background: var(--bg-gradient);
  transform: translateY(-3px);
}

/* Moved to contact.css */

/* Responsive */
@media (max-width: 900px) {
  h1 {
    font-size: 2.5rem;
  }
  h2 {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  main {
    padding-top: 80px; /* Reduced for mobile */
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    z-index: 1050; /* Covers everything except hamburger */
    padding: 100px 30px 40px;
    gap: 0;

    /* Animation */
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.5s cubic-bezier(0.77, 0, 0.175, 1);
    box-shadow: none;
    max-height: none;
    overflow-y: auto; /* Allow menu itself to scroll if content is long */
  }

  .nav-links.active {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
  }

  .nav-links li {
    width: 100%;
    margin: 0;
    padding: 15px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    opacity: 0;
    transform: translateY(20px);
    transition: 0.5s ease;
  }

  .nav-links li:last-child {
    border-bottom: none;
    margin-top: 20px;
  }

  .nav-links.active li {
    opacity: 1;
    transform: translateY(0);
  }

  /* Stagger Animation for items */
  .nav-links.active li:nth-child(1) {
    transition-delay: 0.1s;
  }
  .nav-links.active li:nth-child(2) {
    transition-delay: 0.2s;
  }
  .nav-links.active li:nth-child(3) {
    transition-delay: 0.3s;
  }
  .nav-links.active li:nth-child(4) {
    transition-delay: 0.4s;
  }
  .nav-links.active li:nth-child(5) {
    transition-delay: 0.5s;
  }

  .nav-links li a {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-color);
    display: block;
    width: 100%;
  }

  .nav-links li a:hover {
    color: var(--primary-color);
    transform: translateX(10px); /* Move right slightly instead of scale */
  }

  /* Mobile specific style for the CTA button */
  .nav-links li a.btn-header-cta {
    display: flex;
    width: 100%;
    min-width: unset;
    margin-top: 10px;
    justify-content: center;
    background: linear-gradient(
      135deg,
      var(--primary-color) 0%,
      var(--secondary-color) 100%
    );
    box-shadow: 0 10px 25px rgba(79, 70, 229, 0.3);
    color: white;
  }

  .hamburger {
    display: flex;
  }

  .hero {
    padding: 40px 0;
  }
  .hero h1 {
    font-size: 1.8rem; /* ปรับขนาดพาดหัวให้พอดี */
    line-height: 1.4;
    margin-bottom: 20px;
  }
  .hero p {
    font-size: 1rem;
    margin-bottom: 20px;
  }
  /* Fix Grid Overflow on Mobile */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr !important;
    gap: 25px !important;
  }

  .hero-content div[style*="margin-bottom: 25px"] {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* ให้ข้อความชิดซ้ายแต่กลุ่มกึ่งกลาง */
    max-width: fit-content;
    margin: 0 auto 25px auto;
  }
  .highlight {
    font-size: 0.95rem;
    text-align: left;
    margin-bottom: 12px !important; /* เพิ่มระยะห่างระหว่างข้อความ */
  }
  .hero-image {
    margin-top: 30px;
  }

  .hero-actions {
    width: 100%;
    flex-direction: column; /* เรียงปุ่มบน-ล่าง */
    gap: 12px !important;
  }
  .hero-actions .btn {
    width: 100%; /* ปุ่มกว้างเต็มหน้าจอ */
    padding: 14px;
  }
  .hero-contact-wrapper {
    flex-direction: column !important; /* แยกเบอร์โทรกับ Line คนละบรรทัด */
    gap: 10px !important;
    margin-top: 30px !important;
  }

  .hero-contact-wrapper span[style*="width: 1px"] {
    display: none; /* ซ่อนเส้นแบ่งแนวตั้งบนมือถือ */
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 20px;
  }
  h1 {
    font-size: 1.8rem;
  }
}
