:root {
    --primary-color: #007bff;
    --primary-hover: #3395ff;
    --background-dark: #121212;
    --background-light: #f8f9fa; /* Light background for sections */
    --surface-dark: #1e1e1e; /* For cards on dark bg */
    --surface-light: #ffffff; /* For cards on light bg */
    --text-on-dark: #e9ecef;
    --text-on-light: #212529; /* Dark text for light bg */
    --text-muted-dark: #adb5bd;
    --text-muted-light: #6c757d; /* Muted text for light bg */
    --border-color-dark: #343a40;
    --border-color-light: #dee2e6;
}

body {
    font-family: 'Roboto', 'Noto Sans TC', sans-serif;
    background-color: var(--background-dark);
    color: var(--text-on-dark);
    margin: 0;
    padding: 0;
    line-height: 1.7;
}

.section {
    padding: 80px 20px 120px 20px;
    overflow-x: hidden; /* Prevent horizontal scrollbar from animations */
    position: relative; /* IMPORTANT: For absolute positioning of children */
}

.bg-light {
    background-color: var(--background-light);
    color: var(--text-on-light);
}

.bg-dark {
    background-color: var(--background-dark);
    color: var(--text-on-dark);
}

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

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

header.hero {
    background: linear-gradient(135deg, #0d1b2a 0%, #1b263b 100%);
    text-align: center;
    color: var(--text-on-dark);
    position: relative; /* Needed for particles.js */
    height: 350px;
}

@media (max-width: 768px) {
  header.hero {
    height: 500px;
  }
}

#about{
  margin-top: -100px;
}

#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 0;
}

.hero .container {
    position: relative;
    z-index: 1;
}

header.hero h1 {
    font-weight: 700;
    font-size: 3.5rem;
    letter-spacing: 1px;
    animation: fadeInDown 1s ease-out;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

header.hero p {
    margin-top: 20px;
    font-size: 1.25rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    animation: fadeInUp 1s ease-out 0.5s;
    animation-fill-mode: forwards;
    color: var(--text-muted-dark);
}

.section-title {
    text-align: center;
    margin-bottom: 60px;
    font-size: 2.5rem;
    font-weight: 700;
    position: relative;
    padding-bottom: 15px;
}

.bg-light .section-title { color: var(--text-on-light); }
.bg-dark .section-title { color: var(--text-on-dark); }

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

.card {
    border-radius: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.bg-light .card {
    background-color: var(--surface-light);
    border: 1px solid var(--border-color-light);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.bg-dark .card {
    background-color: var(--surface-dark);
    border: 1px solid var(--border-color-dark);
}

.card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0, 123, 255, 0.15);
}

.card-body {
    flex-grow: 1;
    padding: 30px;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 20px;
}

.bg-light .card-title { color: var(--text-on-light); }
.bg-dark .card-title { color: var(--text-on-dark); }

.card-text {
    line-height: 1.6;
}
.bg-light .card-text { color: var(--text-muted-light); }
.bg-dark .card-text { color: var(--text-muted-dark); }

.case-study-img-wrapper {
    width: 100%;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border-radius: 12px 12px 0 0;
    background-color: #333;
}

.case-study-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.card:hover .case-study-img {
    transform: scale(1.08);
}

.btn-primary-custom {
    display: inline-block;
    background-color: var(--primary-color);
    border: 1px solid var(--primary-color);
    color: #fff;
    padding: 12px 30px;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-primary-custom:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #fff;
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.video-container {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    max-width: 100%;
    border-radius: 12px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.cta-section {
    padding: 40px;
    border-radius: 12px;
    text-align: center;
}
.bg-light .cta-section { background-color: var(--surface-light); border: 1px solid var(--border-color-light); }
.bg-dark .cta-section { background-color: var(--surface-dark); }

.cta-section .lead {
    color: var(--text-muted-light);
}
.bg-dark .cta-section .lead {
    color: var(--text-muted-dark);
}

/* Animation */
.reveal-on-scroll {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}
.reveal-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* Parallax Section */
.parallax-section {
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-attachment: fixed; /* This creates the parallax scrolling effect */
}

/* Wave Effect */
.wave-container {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100px; /* Adjust as needed */
    overflow: hidden;
    z-index: 1;
}

.wave-container.top {
    top: 0;
    bottom: auto;
    transform: rotate(180deg);
}

.waves {
    position: relative;
    width: 100%;
    height: 100%;
    margin-bottom: -7px; /* Fix for safari gap */
    min-height: 100px;
    max-height: 150px;
}

.parallax > use {
    animation: move-forever 25s cubic-bezier(.55, .5, .45, .5) infinite;
}
.parallax > use:nth-child(1) {
    animation-delay: -2s;
    animation-duration: 7s;
}
.parallax > use:nth-child(2) {
    animation-delay: -3s;
    animation-duration: 10s;
}
.parallax > use:nth-child(3) {
    animation-delay: -4s;
    animation-duration: 13s;
}
.parallax > use:nth-child(4) {
    animation-delay: -5s;
    animation-duration: 20s;
}

@keyframes move-forever {
    0% {
        transform: translate3d(-90px, 0, 0);
    }
    100% {
        transform: translate3d(85px, 0, 0);
    }
}

/* For mobile devices */
@media (max-width: 768px) {
    .waves {
        height: 40px;
        min-height: 40px;
    }
    .wave-container {
        height: 40px;
    }
    .parallax-bg {
        background-attachment: scroll; /* Disable fixed background for better mobile performance */
    }
}