/*
 * Raqami Technology - Main Stylesheet
 * Version: 4.3 (Light Mode Color Fix)
 */

/* 1. ROOT VARIABLES & FONT IMPORTS
/* ------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&family=Open+Sans:wght@300;400;600&display=swap');

:root {
    /* Color Palette - LIGHT MODE (Default) */
    --bg-color: #F0F2F5;
    --card-color: #FFFFFF;
    --card-color-rgb: 255, 255, 255;
    --bg-color-rgb: 240, 242, 245;
    --border-color: #E0E0E0;
    --primary-color: #00BCD4;   /* Teal Accent */
    --success-color: #4CAF50;
    --error-color: #D32F2F;

    /* Text Colors - LIGHT MODE */
    --text-primary: #111111;
    --text-secondary: #555555;
    --text-dark: #111111;

    /* Font Families */
    --font-heading: 'Montserrat', sans-serif;
    --font-body: 'Open Sans', sans-serif;

    /* Spacing & Sizing */
    --padding-section: 6rem 0;
    --max-width: 1200px;
    --border-radius: 1.5rem; /* 24px */
    --card-border: 1px solid var(--border-color);
}

/* 1b. DARK MODE VARIABLES
/* ------------------------------------------------- */
body.dark-mode {
    --bg-color: #151515;
    --card-color: #1C1C1C;
    --card-color-rgb: 28, 28, 28;
    --bg-color-rgb: 21, 21, 21;
    --border-color: #2A2A2A;
    
    /* Text Colors - DARK MODE */
    --text-primary: #F5F5F7;
    --text-secondary: #A1A1A6;
}


/* 2. PRELOADER & LOADING STATE
/* ------------------------------------------------- */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: #151515;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    /* This transition fades the preloader out */
    transition: opacity 0.5s ease-out 1s, visibility 0.5s ease-out 1s;
    opacity: 1;
    visibility: visible;
}

.preloader-text {
    text-align: center;
    width: 90%;
    max-width: 800px;
}

.preloader-text p {
    color: #00BCD4;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 2rem;
    margin: 1rem 0;
    opacity: 0; /* JS will fade in spans */
}

.preloader-text p.line2 {
    font-size: 2.5rem;
    color: #F5F5F7; /* White */
}

.preloader-text p.line3 {
    font-size: 1.25rem;
    color: #A1A1A6;
}

/* Letter-by-letter animation */
.preloader-text p span {
    opacity: 0;
    display: inline-block;
    animation: fadeInLetter 0.3s ease-out forwards;
}

@keyframes fadeInLetter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Loading state */
body.loading main,
body.loading header,
body.loading footer,
body.loading .reach-out {
    visibility: hidden; /* Hide content while loading */
}

/* Loaded state */
body:not(.loading) #preloader {
    opacity: 0;
    visibility: hidden;
}


/* 3. GLOBAL STYLES
/* ------------------------------------------------- */

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-secondary);
    background-color: var(--bg-color);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Star Field Background */
#particles-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-bottom: 1rem;
    font-weight: 700;
    transition: color 0.3s ease;
}

h1 { font-size: 3.5rem; line-height: 1.2; }
h2 { font-size: 2.5rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.25rem; }

p { 
    margin-bottom: 1rem; 
    max-width: 65ch;
    transition: color 0.3s ease;
}

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

a:hover {
    color: var(--text-primary);
}
body.dark-mode a:hover {
    color: var(--primary-color);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* 4. UTILITY & SHARED STYLES
/* ------------------------------------------------- */

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 20px;
}

.section-padded {
    padding: var(--padding-section);
    transition: background-color 0.3s ease;
    position: relative; /* Ensure content is above particle background */
    z-index: 2;
}

/* Animations for scroll */
.section-padded {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}
.section-padded.fade-in {
    opacity: 1;
    transform: translateY(0);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 3.5rem;
}

.section-subtitle {
    text-align: center;
    font-size: 1.1rem;
    margin: -2.5rem auto 3rem auto;
    max-width: 600px;
}

/* Light background for contrast */
.bg-light {
    background-color: #FAFAFA;
}
body.dark-mode .bg-light {
    background-color: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    font-family: var(--font-heading);
    transition: all 0.3s ease;
    border: 2px solid transparent;
    cursor: pointer;
}

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

.btn-primary:hover {
    background-color: var(--text-primary);
    color: var(--text-dark);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
body.dark-mode .btn-primary:hover {
    background-color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0, 188, 212, 0.1);
}


.btn-secondary {
    background-color: transparent;
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}
body.dark-mode .btn-secondary {
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: var(--text-primary);
    color: var(--text-dark);
    border-color: var(--text-primary);
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}


/* 5. HEADER & NAVIGATION
/* ------------------------------------------------- */

.main-header {
    background-color: rgba(var(--bg-color-rgb), 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 20px 0;
    border-bottom: 1px solid var(--border-color);
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .main-header {
    background-color: rgba(var(--bg-color-rgb), 0.75);
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-primary);
}
.logo:hover {
    color: var(--primary-color);
}

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

.main-nav ul {
    display: flex;
}

.main-nav ul li {
    margin-left: 30px;
}

.main-nav ul li a {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1rem;
    position: relative;
    padding-bottom: 5px;
}
.main-nav ul li a:hover {
    color: var(--text-primary);
}
.main-nav ul li a.active {
    color: var(--text-primary);
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--text-primary);
    cursor: pointer;
    z-index: 1001;
}

/* 5b. THEME TOGGLE SWITCH
/* ------------------------------------------------- */
.theme-switch-wrapper {
    margin-left: 2rem;
    display: flex;
    align-items: center;
}
.theme-switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}
.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 28px;
}
body.dark-mode .slider {
    background-color: var(--border-color);
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
}
.slider .sun-icon, .slider .moon-icon {
    position: absolute;
    font-size: 14px;
    z-index: 1;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.3s ease;
}
.slider .sun-icon {
    left: 7px;
    color: #f39c12;
    opacity: 1;
}
.slider .moon-icon {
    right: 7px;
    color: var(--text-primary);
    opacity: 0;
}

input:checked + .slider {
    background-color: var(--primary-color);
}
input:checked + .slider:before {
    transform: translateX(26px);
}
input:checked + .slider .sun-icon {
    opacity: 0;
}
input:checked + .slider .moon-icon {
    opacity: 1;
}
body.dark-mode .slider .moon-icon {
    color: #f1c40f;
}

/* 6. HERO SECTION
/* ------------------------------------------------- */

.hero {
    background-color: var(--bg-color);
    color: var(--text-primary);
    text-align: center;
    padding: 180px 0 120px;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}
body.dark-mode .hero {
    background-color: transparent; /* Show particles */
}

.hero .container {
    max-width: 800px;
}

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

.hero p {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin: 1.5rem auto 2.5rem auto;
}

.hero-cta {
    display: flex;
    justify-content: center;
    gap: 1rem;
}

/* 7. BENTO GRIDS (Products & Services)
/* ------------------------------------------------- */

.bento-grid {
    display: grid;
    gap: 1.5rem;
}

.product-grid {
    grid-template-columns: repeat(3, 1fr);
}

.service-grid {
    grid-template-columns: repeat(3, 1fr);
}

.bento-item {
    background-color: var(--card-color);
    border: var(--card-border);
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
    transition: all 0.3s ease;
}
body.dark-mode .bento-item {
    background-color: rgba(var(--card-color-rgb), 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.bento-item:hover {
    transform: scale(1.02) translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.07);
}
body.dark-mode .bento-item:hover {
    background-color: rgba(var(--card-color-rgb), 0.9);
    box-shadow: 0 8px 25px rgba(0, 188, 212, 0.1);
}

.bento-item h3 {
    font-size: 1.5rem;
}
.bento-item h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}
.bento-item p {
    font-size: 0.95rem;
}
.bento-item a {
    font-weight: 600;
}

/* Grid Layouts */
.bento-item-large {
    grid-column: span 2;
}
.product-grid .bento-item-large-col {
    grid-column: span 2;
}
.service-grid .bento-item-large-col {
    grid-column: span 2;
}
.service-grid .bento-item-large {
    grid-column: span 2;
}


/* Card-Specific Styles */
.bento-item-product {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.bento-item-product .card-content {
    flex: 1;
}
.bento-item-product .card-image {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.bento-item-product .card-image img {
    max-height: 200px;
    object-fit: contain;
    border-radius: 1rem;
}

.bento-item-service {
    text-align: center;
    align-items: center;
}

.card-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}
.card-icon-small {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}


/* 8. GALLERY SECTION
/* ------------------------------------------------- */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--border-radius);
    border: var(--card-border);
    background-color: var(--card-color);
    transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.gallery-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.02) translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.07);
}
body.dark-mode .gallery-item:hover {
    box-shadow: 0 8px 25px rgba(0, 188, 212, 0.1);
}


.gallery-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

.gallery-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(0deg, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: #FFFFFF;
    padding: 2rem 1.5rem 1.5rem;
    font-weight: 600;
    font-family: var(--font-heading);
    transform: translateY(100%);
    opacity: 0;
    transition: all 0.4s ease;
}

.gallery-item:hover .gallery-overlay {
    transform: translateY(0);
    opacity: 1;
}

/* 9. ABOUT US SECTION
/* ------------------------------------------------- */
.about-content {
    display: flex;
    gap: 3rem;
    align-items: center;
    flex-wrap: wrap;
}

.about-text {
    flex: 2;
    min-width: 300px;
}

.about-text h3 {
    margin-top: 2rem;
    font-size: 1.6rem;
    color: var(--primary-color);
}

.about-text ul {
    margin-top: 1rem;
}

.about-text ul li {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    gap: 0.75rem;
}

.about-text ul li .fas {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.about-image {
    flex: 1;
    min-width: 300px;
    text-align: center;
}

.about-image img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
}

/* 10. CONTACT SECTION
/* ------------------------------------------------- */
.contact-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.contact-form-wrapper {
    background-color: var(--card-color);
    border: var(--card-border);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.contact-form-wrapper:hover {
    transform: scale(1.01);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.05);
}
body.dark-mode .contact-form-wrapper:hover {
     box-shadow: 0 8px 25px rgba(0, 188, 212, 0.05);
}

body.dark-mode .contact-form-wrapper {
    background-color: rgba(var(--card-color-rgb), 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.contact-info {
    padding-top: 1rem;
}

.contact-info h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
}

.contact-info p {
    margin-bottom: 15px;
    font-size: 1.1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.contact-info p .fas {
    color: var(--primary-color);
    font-size: 1.3rem;
    margin-top: 3px;
}
.contact-info a {
    color: var(--text-secondary);
}
.contact-info a:hover {
    color: var(--primary-color);
}

.social-links {
    margin-top: 2rem;
    display: flex;
    gap: 1.5rem;
}

.social-links a {
    font-size: 1.8rem;
    color: var(--text-secondary);
    transition: color 0.3s ease, transform 0.3s ease;
}
.social-links a:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.map-container {
    margin-top: 2rem;
    overflow: hidden;
    border-radius: 1rem;
}

/* Contact Form */
.form-group-custom {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 14px;
    height: 50px;
    border-radius: 8px;
    color: var(--text-primary);
    background-color: var(--bg-color);
    font-size: 1rem;
    font-family: var(--font-body);
    outline: none;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}
body.dark-mode .form-input {
     background-color: rgba(var(--bg-color-rgb), 0.8);
}

.form-input::placeholder {
    color: var(--text-secondary);
}

.form-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 188, 212, 0.25);
    background-color: var(--card-color);
}
body.dark-mode .form-input:focus {
    background-color: #151515;
}

textarea.form-input {
    height: auto;
    min-height: 120px;
    resize: vertical;
}

.btn-submit-custom {
    width: 100%;
    font-size: 1rem;
}

.form-result {
    font-size: 1rem;
    text-align: center;
    margin-top: 1.5rem;
    font-weight: 600;
    display: none;
    padding: 1rem;
    border-radius: 8px;
}

.form-result.success-message {
    display: block;
    color: var(--success-color);
    background-color: rgba(76, 175, 80, 0.1);
}

.form-result.error-message {
    display: block;
    color: var(--error-color);
    background-color: rgba(211, 47, 47, 0.1);
}

/* 11. REACH OUT SECTION
/* ------------------------------------------------- */
.reach-out {
    padding: 3rem 0;
    background-color: var(--bg-color);
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    position: relative; /* z-index to be above particles */
    z-index: 2;
}
body.dark-mode .reach-out {
    background-color: rgba(var(--bg-color-rgb), 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.reach-out .container {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 1.5rem;
}
.reach-out-item {
    font-size: 1.1rem;
    color: var(--text-secondary);
}
.reach-out-item strong {
    color: var(--text-primary);
    font-weight: 600;
}
.reach-out-item a {
    font-weight: 600;
}


/* 12. FOOTER
/* ------------------------------------------------- */

.main-footer {
    background-color: var(--card-color);
    color: var(--text-secondary);
    padding: 3rem 0;
    text-align: center;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    position: relative; /* z-index to be above particles */
    z-index: 2;
}
body.dark-mode .main-footer {
    background-color: rgba(var(--bg-color-rgb), 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.main-footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.footer-nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-nav ul li {
    margin: 0 15px 10px;
}

.footer-nav ul li a {
    color: var(--text-secondary);
}

.footer-nav ul li a:hover {
    color: var(--text-primary);
}
body.dark-mode .footer-nav ul li a:hover {
    color: var(--primary-color);
}

/* 13. RESPONSIVENESS
/* ------------------------------------------------- */

@media (max-width: 992px) {
    h1 { font-size: 2.8rem; }
    h2 { font-size: 2.2rem; }

    /* Bento Grids Tablet */
    .product-grid,
    .service-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .bento-item-large,
    .bento-item-large-col {
        grid-column: span 2; /* Full width on tablet */
    }

    /* Contact Tablet */
    .contact-layout {
        grid-template-columns: 1fr;
    }

    /* Mobile Nav */
    .main-nav {
        display: none;
        flex-direction: column;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        background-color: rgba(var(--bg-color-rgb), 0.95);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        justify-content: center;
        align-items: center;
        transform: translateX(100%);
        transition: transform 0.3s ease-in-out;
    }

    .main-nav.active {
        display: flex;
        transform: translateX(0);
    }
    .main-nav ul {
        flex-direction: column;
        align-items: center;
        gap: 1.5rem;
    }
    .main-nav ul li {
        margin: 0;
    }
    .main-nav ul li a {
        font-size: 1.5rem;
    }
    .theme-switch-wrapper {
        margin-left: 0;
        margin-top: 2rem;
    }
    .nav-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    .section-padded { padding: 4rem 0; }

    .hero { padding: 140px 0 80px; }

    .preloader-text p {
        font-size: 1.5rem;
    }
    .preloader-text p.line2 {
        font-size: 2rem;
    }
    .preloader-text p.line3 {
        font-size: 1rem;
    }


    /* Bento Grids Mobile */
    .product-grid,
    .service-grid {
        grid-template-columns: 1fr; /* Single column */
    }
    .bento-item-large,
    .bento-item-large-col {
        grid-column: 1 / 2; /* All items full width */
        grid-row: auto;
    }
    .bento-item-product {
        flex-direction: column-reverse; /* Stack content, image on top */
    }
    .bento-item-product .card-image img {
        max-height: 150px;
    }

    .about-content {
        flex-direction: column-reverse; /* Stack and reverse */
    }
    
    .hero-cta {
        flex-direction: column;
        gap: 1rem;
        padding: 0 1rem;
    }

    .reach-out .container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}