/* css/custom.css */

/* --- Header Styles --- */
#sticker {
    z-index: 999;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.7); /* Semi-transparent dark header */
    transition: background-color 0.3s ease;
}

/* === Body Background Slideshow Styling === */
html, body { height: 100%; margin: 0; padding: 0; }
body {
  /* Use Kanit first, then Raleway as fallback */
  font-family: 'Kanit', 'Raleway', sans-serif;
  font-size: 16px;
  line-height: 1.75;
  color: #eee; /* Default light text color for body */
  background-color: #333; /* Fallback background */
  position: relative;
  overflow-x: hidden;
}
/* The sliding background image layer */
body::before {
   content: "";
   position: fixed;
   top: 0; left: 0; right: 0; bottom: 0;
   z-index: -1; /* Behind the content */
   background-size: cover;
   background-position: center center;
   background-repeat: no-repeat;
   /* Animation: 20s total duration, infinite loop, ease-in-out timing */
   animation: bodySlideFade 20s infinite ease-in-out;
   /* Start with the first image */
   background-image: url('../img/slider/factory_view.jpg');
   opacity: 1; /* Fully visible */
}

/* Keyframes for the background image slideshow (fade + subtle zoom) */
@keyframes bodySlideFade {
   0%, 100% { background-image: url('../img/slider/factory_view.jpg'); opacity: 1; transform: scale(1); }
   20%      { background-image: url('../img/slider/factory_view.jpg'); opacity: 1; transform: scale(1.03); } /* Hold slide 1 + zoom */
   25%      { background-image: url('../img/slider/slider1.jpg'); opacity: 1; transform: scale(1); }      /* Fade to slide 2 */
   45%      { background-image: url('../img/slider/slider1.jpg'); opacity: 1; transform: scale(1.03); } /* Hold slide 2 + zoom */
   50%      { background-image: url('../img/slider/slider2.jpg'); opacity: 1; transform: scale(1); }      /* Fade to slide 3 */
   70%      { background-image: url('../img/slider/slider2.jpg'); opacity: 1; transform: scale(1.03); } /* Hold slide 3 + zoom */
   75%      { background-image: url('../img/slider/factory_mangement.jpg'); opacity: 1; transform: scale(1); }      /* Fade to slide 4 */
   95%      { background-image: url('../img/slider/factory_mangement.jpg'); opacity: 1; transform: scale(1.03); } /* Hold slide 4 + zoom */
   /* Note: The transition back to the first image happens between 95% and 100% */
   /* Add more images here following the pattern if needed */
}

/* === Content Wrapper Styling === */
.main-content-wrapper {
  position: relative; /* Needed for z-index stacking */
  z-index: 1; /* Ensure content is above the body::before background */
  /* Semi-transparent overlay */
  background-color: rgba(0, 0, 0, 0.75); /* Using the lighter 0.75 value */
  min-height: 100vh; /* Ensure wrapper fills viewport height */
  padding-top: 90px; /* Adjust padding to clear the fixed header (70px header + 20px buffer) */
  padding-bottom: 40px; /* Add some space at the bottom */
}

/* === Text Slider Styles === */
#text-slider {
    /* area-padding provides vertical padding */
    height: 60px; /* Adjust height as needed */
    position: relative;
    overflow: hidden;
    margin-bottom: 20px; /* Space below the slider */
    background: rgba(255, 255, 255, 0.1); /* Subtle background */
    border-radius: 5px;
}
.text-slider-content {
    position: relative;
    height: 100%;
}
#text-slider .slide-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px; /* Adjust size */
    font-weight: 500;
    color: #fff; /* Text color */
    animation: textFade 20s infinite ease-in-out;
}
#text-slider .slide-text span.lang-en span, /* Target the inner span for color */
#text-slider .slide-text span.lang-th span { /* Target the inner span for color */
    font-weight: 700;
    color: #3EC1D5; /* Accent color */
    margin-right: 10px;
}


/* Assign animation delays to each text slide */
#text-slider .slide-text:nth-child(1) { animation-delay: 0s; }
#text-slider .slide-text:nth-child(2) { animation-delay: 5s; }
#text-slider .slide-text:nth-child(3) { animation-delay: 10s; }
#text-slider .slide-text:nth-child(4) { animation-delay: 15s; }
/* Total duration = 4 slides * 5s = 20s */

@keyframes textFade {
  0%   { opacity: 0; transform: translateY(10px); } /* Start faded out and slightly down */
  5%   { opacity: 1; transform: translateY(0); }  /* Fade in and move up */
  20%  { opacity: 1; transform: translateY(0); }  /* Hold visible */
  25%  { opacity: 0; transform: translateY(-10px);} /* Fade out and move up */
  100% { opacity: 0; } /* Stay faded out */
}


/* --- Product Card Improvements (Keep original styling as background is white) --- */
#portfolio .section-headline h2 { color: #eee; } /* Headline color over dark wrapper */
.single-awesome-project { background: #fff; border-radius: 8px; overflow: hidden; margin-bottom: 30px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); transition: all 0.3s ease-in-out; }
.single-awesome-project:hover { box-shadow: 0 8px 25px rgba(0,0,0,0.15); transform: translateY(-5px); }
.awesome-img img, .awesome-img iframe { width: 100%; height: 200px; object-fit: cover; display: block; border: none; }
.project-details { padding: 20px; background: #fff; } /* White background for card details */
.project-details h4 { font-size: 18px; font-weight: 600; margin-top: 0; margin-bottom: 10px; color: #333; } /* Dark text inside card */
.project-details p { font-size: 14px; color: #666; margin-bottom: 15px; min-height: 50px; } /* Dark text inside card */
.project-cta a { margin-right: 5px; margin-bottom: 5px; font-size: 12px; padding: 5px 10px; }
.single-awesome-project .add-actions { display: none; }

/* --- General Adjustments & Text Colors for Dark Background --- */
.area-padding { padding: 60px 0; } /* Reduced default padding slightly */
.navbar-right img { vertical-align: middle; margin-top: -3px;}
.our-skill-area { display: none; } /* Hidden as per original */
footer { position: relative; z-index: 2; background: none; } /* Ensure footer is above background and no own bg */

/* Section Headlines inside the dark wrapper */
.main-content-wrapper .section-headline h2 {
    color: #eee; /* Light color for headlines */
    margin-bottom: 60px;
}
.main-content-wrapper .section-headline h2::after {
    border-color: #eee; /* Light underline */
    bottom: -15px;
}

/* Services Section Text */
.services-area { background-color: transparent !important; } /* Make sure services area doesn't override wrapper bg */
.main-content-wrapper .single-services h4 { color: #fff; font-size: 20px; font-weight: 600; }
.main-content-wrapper .single-services p { color: #ccc; font-size: 15px; line-height: 1.7; }
.main-content-wrapper .services-icon { color: #3EC1D5; } /* Use accent color for icons */
.main-content-wrapper .services-details:hover h4,
.main-content-wrapper .services-details:hover .services-icon {
  color: #4adedf; /* Lighter accent on hover */
}


/* About Section Text */
#about { background-color: transparent !important; }
#about .well-middle { padding-top: 20px; }
#about .well-middle .single-well { max-width: 800px; margin: 0 auto; text-align: center;} /* Center align content */
#about .sec-head { color: #fff; font-size: 20px; font-weight: 600; text-transform: none; margin-bottom: 10px; }
#about .single-well p { font-size: 16px; line-height: 1.8; color: #ccc;}
#about .single-well h5 { font-size: 17px; font-weight: 600; margin-top: 20px; margin-bottom: 8px; color: #eee;}
/* Make sure the UL itself is centered, but text inside it is left-aligned */
#about .single-well .text-left { text-align: left !important; } /* This targets the UL */
#about .single-well ul { display: inline-block; /* Allows centering if parent is text-center */ text-align: left; }
#about .single-well ul li { padding: 3px 0; font-size: 15px; color: #ccc;}
#about .single-well ul li i { color: #3EC1D5; margin-right: 8px; }


/* Testimonials (Has its own overlay, text is already white) */
.testi-text p { font-size: 17px; line-height: 1.8; font-style: italic; font-weight: 300; color: #fff; }
.testi-text h6 { font-size: 16px; font-weight: 600; margin-top: 15px; text-transform: uppercase; letter-spacing: 1px; color: #fff; }

/* Contact Section Text */
#contact { background-color: transparent !important; } /* Prevent override */
#contact .section-headline h2 { color: #eee; }
#contact .section-headline h2::after { border-color: #eee; }
.contact-icon .single-icon i { color: #3EC1D5; border-color: #777; } /* Accent icon, slightly lighter border */
.contact-icon p { color: #ccc;}
.contact-icon p span { color: #aaa; } /* Lighter secondary text */
.contact-form input, .contact-form textarea {
    background-color: rgba(255, 255, 255, 0.1); /* Slightly visible inputs */
    border: 1px solid #555;
    color: #eee; /* Light text input */
}
.contact-form input::placeholder, .contact-form textarea::placeholder { color: #999; } /* Placeholder text color */
.contact-form button[type="submit"] {
    background: #3EC1D5;
    border: 1px solid #3EC1D5;
    color: #fff;
}
.contact-form button[type="submit"]:hover {
     background: #2aabbc;
     border-color: #2aabbc;
}
.contact-form #sendmessage { color: #3EC1D5; border-color: #3EC1D5; background-color: rgba(62, 193, 213, 0.1); padding: 10px; margin-bottom: 15px; display: none;}
.contact-form #errormessage { color: #dc3545; border-color: #dc3545; background-color: rgba(220, 53, 69, 0.1); padding: 10px; margin-bottom: 15px; display: none;}
#contact small em { color: #aaa; }

/* --- Footer Background to Match Body Overlay --- */
.footer-area-bottom {
    background-color: rgba(0, 0, 0, 0.75); /* Same as .main-content-wrapper */
    padding: 20px 0;
}
.footer-area-bottom .copyright p {
    color: #ccc;
    margin-bottom: 0;
}
.footer-area-bottom .copyright strong {
    color: #eee;
}
.footer-area-bottom .credits,
.footer-area-bottom .credits a {
     color: #aaa;
     font-size: 13px;
}
.footer-area-bottom .credits a:hover {
     color: #3EC1D5;
}


/* --- Back to Top Button Visibility Enhancement (Method 1: White BG) --- */
.back-to-top {
    background: rgba(255, 255, 255, 0.9); /* พื้นหลังสีขาว โปร่งแสงเล็กน้อย */
    color: #333;                      /* ไอคอนสีเทาเข้ม */
    opacity: 0.8;                     /* ทำให้ปุ่มโปร่งแสงเล็กน้อยตอนปกติ */
    transition: opacity 0.4s ease-in-out, background 0.4s ease-in-out; /* เพิ่ม transition */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2); /* เพิ่มเงาเล็กน้อย */
    border-radius: 4px; /* Match other button styles? */
    padding: 8px 12px 10px 12px; /* Adjusted padding for better centering */
}

.back-to-top:hover {
    background: #ffffff; /* พื้นหลังสีขาวทึบเมื่อเมาส์ชี้ */
    color: #000000;    /* ไอคอนสีดำเมื่อเมาส์ชี้ */
    opacity: 1;       /* ทำให้ทึบแสง 100% เมื่อเมาส์ชี้ */
}

/* Font Adjustments (Using Kanit and Raleway) */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Kanit', 'Raleway', sans-serif; /* Kanit preferred */
    font-weight: 600;
    /* Default color set by context (body or specific sections) */
    margin-bottom: 15px;
    line-height: 1.4;
}
/* Specific header/logo font weights/colors */
.sticky-logo h1 { font-family: 'Raleway', sans-serif; font-weight: bold; color: #fff; margin: 0; line-height: 1;} /* White logo text */
.sticky-logo h1 span { color: #3EC1D5; } /* Accent color for 'P' */
.main-menu ul.navbar-nav li a { font-family: 'Kanit', 'Raleway', sans-serif; font-size: 15px; font-weight: 500; letter-spacing: 0.5px; color: #fff; } /* White menu links */
.main-menu ul.navbar-nav li.active a { color: #3EC1D5 !important; } /* Accent for active */
.main-menu ul.navbar-nav li a:hover { color: #3EC1D5 !important; } /* Accent on hover */
.project-cta a { font-family: 'Kanit', 'Raleway', sans-serif; font-weight: 500; }
.contact-form input, .contact-form textarea { font-family: 'Kanit', 'Raleway', sans-serif; font-size: 15px; }
.contact-form button[type="submit"] { font-family: 'Kanit', 'Raleway', sans-serif; font-weight: 600; }

/* --- Responsive Font Sizes & Adjustments --- */
@media (max-width: 767px) {
 body { font-size: 15px; line-height: 1.7; }
 h1 { font-size: 34px; line-height: 1.3; }
 h2 { font-size: 28px; line-height: 1.3; }
 h3 { font-size: 24px; }
 h4 { font-size: 20px; }
 h5 { font-size: 17px; }
 .main-content-wrapper .section-headline h2 { font-size: 30px; margin-bottom: 40px;}
 .main-content-wrapper .section-headline h2::after { bottom: -10px; }
 .main-menu ul.navbar-nav li a { font-size: 14px; }
 .main-content-wrapper { padding-top: 70px; } /* Adjust wrapper padding for smaller header */
 #text-slider { height: auto; min-height: 50px; } /* Allow text slider height to adjust */
 #text-slider .slide-text { font-size: 16px; padding: 10px; }
 .area-padding { padding: 40px 0; }
 #about .well-middle .single-well ul { padding-left: 15px; /* Adjust indent */ }
}
@media (max-width: 480px) {
 h1 { font-size: 30px; }
 h2 { font-size: 24px; }
 h3 { font-size: 20px; }
 h4 { font-size: 18px; }
 #about .well-middle .single-well ul { padding-left: 20px; /* Indent list on mobile */ }
}