/* ========================================
   RESET & BASE STYLES
   ======================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

html {
    scroll-behavior: smooth;
}

section[id] {
    scroll-margin-top: 90px;
}

body {
    overflow-x: hidden;
    margin: 0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-2);
    color: var(--text);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ========================================
   CSS VARIABLES (DARK THEME - DEFAULT)
   ======================================== */
:root {
    --bg: #0f1115;
    --bg-2: #161a20;
    --text: #eef0f3;
    --muted: #9aa1ab;
    --accent: #3da9fc;
    --line: #262b33;
}

/* ========================================
   LIGHT THEME VARIABLES
   ======================================== */
[data-theme="light"] {
    --bg: #ffffff;
    --bg-2: #f4f5f7;
    --text: #15171b;
    --muted: #5b6068;
    --accent: #1f7fd6;
    --line: #dde1e6;
}

[data-theme="light"] .icon-sun {
    display: none;
}

[data-theme="light"] .icon-moon {
    display: block;
}

/* ========================================
   HEADER
   ======================================== */
header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.wifix-logo {
    height: 36px;
    display: block;
    border-radius: 10px;
}

nav {
    display: flex;
    gap: 28px;
}

.nav-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--bg-2);
    color: var(--text);
    cursor: pointer;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
}

.nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    transition: transform .2s ease, opacity .2s ease;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.links {
    color: var(--muted);
    text-decoration: none;
    font-size: .95rem;
    transition: color .15s ease;
    direction: ltr;
    unicode-bidi: isolate;
    display: inline-block;
}

.links:hover,
.links:focus-visible {
    color: var(--accent);
}

.links:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* ========================================
   LANGUAGE SELECTOR
   ======================================== */
.lang-select {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 5px 8px;
    font-size: .85rem;
    cursor: pointer;
    font-family: inherit;
}

.lang-select:hover {
    border-color: var(--accent);
}

/* ========================================
   THEME TOGGLE BUTTON
   ======================================== */
.theme-toggle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: var(--bg-2);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}

.theme-toggle:hover {
    border-color: var(--accent);
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-moon {
    display: none;
}

/* ========================================
   MAIN CONTENT
   ======================================== */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ========================================
   SLIDESHOW
   ======================================== */
.slideshow {
    position: relative;
    width: 100%;
    max-width: 1000px;
    aspect-ratio: 16/7;
    margin: 50px auto;
    overflow: hidden;
    border-radius: 20px;
    background: var(--bg);
}

.slides {
    position: absolute;
    inset: 0;
}

.slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity .8s ease;
    pointer-events: none;
}

.slide.active {
    opacity: 1;
    pointer-events: auto;
}

.slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.slide::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, .75), rgba(0, 0, 0, .1));
}

.slide-content {
    position: absolute;
    left: 50px;
    bottom: 45px;
    z-index: 3;
    max-width: 500px;
}

.slide-tag,
.section-tag {
    display: inline-block;
    margin-bottom: 10px;
    padding: 5px 12px;
    border-radius: 20px;
    background: rgba(61, 169, 252, .15);
    border: 1px solid rgba(61, 169, 252, .5);
    color: var(--accent);
    font-size: .75rem;
    font-style: italic;
}

.slide-content h2 {
    margin: 0 0 10px;
    font-size: 1.8rem;
}

.slide-content p {
    margin: 0;
    color: #ddd;
}

/* Slideshow Navigation Arrows */
.arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: rgba(15, 17, 21, .55);
    backdrop-filter: blur(6px);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: .2s;
}

.arrow:hover {
    border-color: var(--accent);
    background: rgba(61, 169, 252, .15);
}

.arrow.prev { left: 20px; }
.arrow.next { right: 20px; }

.arrow svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

/* Slideshow Progress Dots */
.dots {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    z-index: 5;
}

.dot {
    width: 34px;
    height: 4px;
    background: rgba(255, 255, 255, .2);
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
}

.fill {
    width: 0;
    height: 100%;
    background: var(--accent);
}

.dot.active .fill {
    animation: fillbar 5s linear forwards;
}

@keyframes fillbar {
    from { width: 0; }
    to { width: 100%; }
}

/* ========================================
   SECTIONS
   ======================================== */
.section {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 60px 25px;
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.section-header h1,
.section-header h2 {
    font-size: 2.5rem;
    margin: 10px 0;
    color: var(--text);
}

.section-header p {
    color: var(--muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

/* ========================================
   SERVICE CARDS
   ======================================== */
.services {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
}

.service-card {
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
    transition: .25s;
}

.service-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
}

.service-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
}

.service-card h2 {
    margin: 20px 20px 5px;
    font-size: 1.2rem;
}

.service-card p {
    margin: 0 20px 20px;
    color: var(--muted);
    line-height: 1.6;
}

/* Projects grid - 4 columns */
.projects-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* ========================================
   FULL WIDTH IMAGE
   ======================================== */
.hero-image-full {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
    border-radius: 16px;
    overflow: hidden;
}

.hero-image-full img {
    width: 100%;
    height: 450px;
    object-fit: cover;
    display: block;
}

/* ========================================
   FOOTER
   ======================================== */
footer {
    background: var(--bg);
    color: var(--muted);
    padding: 48px 32px 24px;
    border-top: 1px solid var(--line);
    margin-top: 40px;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
}

.footer-brand .wifix-logo {
    height: 32px;
    margin-bottom: 12px;
}

.footer-brand p {
    font-size: .9rem;
    line-height: 1.6;
    margin: 0;
    max-width: 260px;
}

.footer-col h3 {
    color: var(--text);
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    margin: 0 0 14px;
}

.footer-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-col .links {
    font-size: .9rem;
}

/* Footer map */
.footer-map {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-map iframe {
    width: 100%;
    max-width: 350px;
    height: 200px;
    border: 0;
    border-radius: 12px;
    background: var(--bg-2);
}

.footer-map .map-directions {
    align-self: flex-start;
    color: var(--accent);
    font-size: .9rem;
    font-weight: 500;
}

.footer-map .map-directions:hover,
.footer-map .map-directions:focus-visible {
    text-decoration: underline;
}

.footer-bottom {
    border-top: 1px solid var(--line);
    padding-top: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.footer-bottom p {
    margin: 0;
    font-size: .8rem;
    color: var(--muted);
}

/* Social Icons */
.socials {
    display: flex;
    gap: 14px;
}

.socials a {
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 50%;
    transition: border-color .15s ease, color .15s ease;
}

.socials a:hover,
.socials a:focus-visible {
    color: var(--accent);
    border-color: var(--accent);
}

.socials svg {
    width: 15px;
    height: 15px;
    fill: currentColor;
}

/* ========================================
   ACTIVE NAV LINK
   ======================================== */
nav .links.active,
nav .links[aria-current="page"] {
    color: var(--accent);
}

/* ========================================
   DOWNLOAD CARDS
   ======================================== */
.download-card {
    text-align: center;
    padding-bottom: 24px;
}

.download-card img {
    height: 150px;
    width: 150px;
    object-fit: contain;
    margin: 20px auto;
    display: block;
    border-radius: 12px;
    padding: 8px;
    box-sizing: border-box;
    background: #fff;
}

[data-theme="light"] .download-card img {
    background: var(--bg-2);
}

.download-card h2 {
    font-size: 1rem;
    margin: 10px 20px;
}

.download-card .hero-btn {
    margin: 10px 20px 0;
}

.dl-category {
    color: var(--accent);
    font-size: 1.2rem;
    margin: 40px 0 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 25px;
}

.dl-unavailable {
    display: inline-block;
    margin: 10px 20px 20px;
    padding: 10px 18px;
    background: var(--bg-2);
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 8px;
    font-size: .85rem;
    font-style: italic;
}

/* ========================================
   TECH CARDS (Programming)
   ======================================== */
.tech-card {
    text-align: center;
    padding-bottom: 20px;
    flex: 1 1 140px;
    max-width: 180px;
}

.tech-card img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin: 20px auto;
    display: block;
    border-radius: 50%;
}

.tech-card h2 {
    font-size: 1rem;
    margin: 0 10px 10px;
}

/* ========================================
   SENSOR SHOWCASE (Programming)
   ======================================== */
.sensor-showcase {
    display: flex;
    gap: 40px;
    align-items: center;
    max-width: 900px;
    margin: 0 auto;
    padding: 30px;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 16px;
}

.sensor-images {
    display: flex;
    gap: 16px;
    flex: 1;
}

.sensor-images img {
    width: 48%;
    border-radius: 12px;
    object-fit: cover;
}

.sensor-info {
    flex: 1;
}

.sensor-info h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--accent);
}

.sensor-info p {
    color: var(--muted);
    line-height: 1.7;
    margin-bottom: 8px;
}

/* ========================================
   HERO BUTTON (shared across pages)
   ======================================== */
.hero-btn {
    display: inline-block;
    margin-top: 30px;
    padding: 14px 28px;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    transition: .2s ease;
}

.hero-btn:hover {
    opacity: .9;
    transform: translateY(-2px);
}

/* ========================================
   WHATSAPP FLOATING BUTTON
   ======================================== */
.whatsapp-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    width: 58px;
    height: 58px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    transition: transform .2s ease, box-shadow .2s ease;
}

.whatsapp-float svg {
    width: 30px;
    height: 30px;
    color: #fff;
}

.whatsapp-float:hover {
    transform: scale(1.08);
    box-shadow: 0 10px 30px rgba(37, 211, 102, .5);
}

.whatsapp-float::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: #25D366;
    opacity: .5;
    animation: pulse 2.2s ease-out infinite;
    z-index: -1;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: .5; }
    100% { transform: scale(1.7); opacity: 0; }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */
@media (max-width: 900px) {
    .nav-toggle {
        display: flex;
    }

    nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        padding: 8px 24px 16px;
        box-shadow: 0 12px 24px rgba(0, 0, 0, .15);
    }

    nav.open {
        display: flex;
    }

    nav .links {
        display: block;
        padding: 12px 0;
        border-bottom: 1px solid var(--line);
        font-size: 1rem;
    }

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

@media (max-width: 720px) {
    header {
        padding: 12px 18px;
    }

    .slideshow {
        aspect-ratio: 4/3;
        margin: 20px;
    }

    .slide-content {
        left: 20px;
        right: 20px;
        bottom: 30px;
        max-width: none;
    }

    .slide-content h2 {
        font-size: 1.3rem;
    }

    .section-header h1,
    .section-header h2 {
        font-size: 1.8rem;
    }

    .hero-image-full img {
        height: 280px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .footer-map {
        align-items: center;
    }

    .footer-map .map-directions {
        align-self: center;
    }

    .footer-col,
    .footer-brand {
        align-items: center;
    }

    .footer-bottom {
        flex-direction: column;
        align-items: center;
    }

    .sensor-showcase {
        flex-direction: column;
        gap: 20px;
        padding: 20px;
    }

    .sensor-images {
        flex-direction: row;
    }

    .tech-card {
        flex: 1 1 120px;
        max-width: 160px;
    }
}

@media (max-width: 600px) {
    .whatsapp-float {
        width: 52px;
        height: 52px;
        bottom: 18px;
        right: 18px;
    }

    .whatsapp-float svg {
        width: 26px;
        height: 26px;
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}