/* =========================================================
   KKD — DARK FUTURISTIC DESIGN SYSTEM
   Khonkaen Dynamics
========================================================= */

/* =========================================================
   VARIABLES
========================================================= */

:root {
    --black: #000000;
    --dark: #000000;
    --dark-2: #05080c;
    --dark-3: #0a0f18;

    --blue: #1478ff;
    --blue-light: #3c96ff;
    --cyan: #00d9ff;

    --white: #f5f8fc;
    --gray: #8996a6;
    --gray-light: #b8c3d0;

    --border: rgba(90, 160, 255, 0.16);
    --border-bright: rgba(0, 217, 255, 0.35);

    --glow-blue: 0 0 35px rgba(20, 120, 255, 0.22);
    --glow-cyan: 0 0 35px rgba(0, 217, 255, 0.18);

    --radius: 18px;
}

/* =========================================================
   RESET & GLOBAL BACKGROUND
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    background-color: #000000 !important;
}

body {
    background-color: #000000 !important;
    color: #f5f8fc !important;
    font-family: "Inter", sans-serif;
    line-height: 1.6;
    overflow-x: hidden;
}

main,
section,
.hero,
.section,
.robotics-section,
.engineering-section,
.about-section,
.stats-section,
.contact {
    background-color: transparent !important;
}

/* =========================================================
   FUTURISTIC BACKGROUND GRID
========================================================= */

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(20, 120, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(20, 120, 255, 0.035) 1px, transparent 1px);
    background-size: 55px 55px;
    mask-image: linear-gradient(to bottom, black, transparent 85%);
    z-index: -10;
}

/* =========================================================
   NAVIGATION
========================================================= */

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 6%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    z-index: 1000;
}

.logo {
    color: var(--white);
    text-decoration: none;
    font-family: "Space Grotesk", sans-serif;
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 1px;
}

.logo span {
    color: var(--cyan);
}

.nav {
    display: flex;
    gap: 35px;
}

.nav a {
    position: relative;
    color: var(--gray);
    text-decoration: none;
    font-size: 13px;
    transition: .3s;
}

.nav a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -8px;
    width: 0;
    height: 1px;
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
    transition: .3s;
}

.nav a:hover {
    color: white;
}

.nav a:hover::after {
    width: 100%;
}

.mobile-menu-button {
    display: none;
    border: none;
    background: transparent;
    color: white;
    font-size: 25px;
    cursor: pointer;
}

/* =========================================================
   HERO
========================================================= */

.hero {
    min-height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    padding: 140px 8% 100px;
    overflow: hidden;
}

.hero::before {
    content: "";
    position: absolute;
    width: 800px;
    height: 800px;
    right: -250px;
    top: 40px;
    background: radial-gradient(circle, rgba(20, 120, 255, 0.17), transparent 68%);
    filter: blur(20px);
    pointer-events: none;
}

.hero::after {
    content: "";
    position: absolute;
    width: 500px;
    height: 500px;
    left: -250px;
    bottom: -200px;
    background: radial-gradient(circle, rgba(0, 217, 255, 0.08), transparent 70%);
    pointer-events: none;
}

.hero-orbit {
    position: absolute;
    border: 1px solid rgba(0, 217, 255, 0.08);
    border-radius: 50%;
    pointer-events: none;
}

.orbit-1 {
    width: 600px;
    height: 600px;
    right: -100px;
    top: 100px;
    transform: rotate(25deg);
}

.orbit-2 {
    width: 400px;
    height: 200px;
    right: 0;
    top: 300px;
    transform: rotate(-25deg);
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 900px;
}

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    border: 1px solid rgba(0, 217, 255, 0.25);
    border-radius: 999px;
    color: var(--cyan);
    font-size: 11px;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 30px;
    background: rgba(0, 217, 255, 0.035);
}

.hero-tag::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 12px var(--cyan);
}

.hero h1 {
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(52px, 8vw, 105px);
    line-height: .98;
    letter-spacing: -5px;
}

.hero h1 .gradient {
    display: block;
    background: linear-gradient(90deg, #ffffff 0%, #4d9cff 45%, #00d9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-description {
    margin-top: 30px;
    max-width: 650px;
    color: var(--gray);
    font-size: 18px;
}

.hero-buttons {
    display: flex;
    gap: 15px;
    margin-top: 40px;
    flex-wrap: wrap;
}

/* =========================================================
   BUTTONS
========================================================= */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 25px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: .3s;
}

.btn-primary {
    color: white;
    background: linear-gradient(135deg, #1478ff, #0055c7);
    box-shadow: 0 0 30px rgba(20, 120, 255, 0.25);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 45px rgba(20, 120, 255, 0.45);
}

.btn-outline {
    color: var(--gray-light);
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

.btn-outline:hover {
    color: white;
    border-color: var(--cyan);
    box-shadow: var(--glow-cyan);
}

.hero-tech {
    position: absolute;
    right: 7%;
    bottom: 70px;
    display: flex;
    gap: 40px;
    color: #4f5e70;
    font-size: 10px;
    letter-spacing: 1.5px;
}

.hero-tech strong {
    display: block;
    color: var(--gray-light);
    font-size: 14px;
}

/* =========================================================
   SECTION & CARDS
========================================================= */

.section {
    padding: 130px 8%;
    position: relative;
}

.section-header {
    max-width: 800px;
    margin-bottom: 60px;
}

.section-label {
    color: var(--cyan);
    font-size: 11px;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.section-title {
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(38px, 5vw, 65px);
    line-height: 1.05;
    letter-spacing: -2px;
}

.section-description {
    margin-top: 20px;
    color: var(--gray);
    max-width: 650px;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.tech-card {
    position: relative;
    min-height: 300px;
    padding: 35px;
    background: linear-gradient(145deg, rgba(12, 16, 24, 0.95), rgba(0, 0, 0, 0.98));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: .35s;
}

.tech-card::before {
    content: "";
    position: absolute;
    width: 220px;
    height: 220px;
    right: -100px;
    top: -100px;
    background: radial-gradient(circle, rgba(0, 217, 255, 0.13), transparent 70%);
}

.tech-card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 217, 255, 0.4);
    box-shadow: var(--glow-blue);
}

.tech-number {
    position: absolute;
    top: 25px;
    right: 30px;
    color: rgba(255, 255, 255, 0.08);
    font-size: 40px;
    font-weight: 700;
}

.tech-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    color: var(--cyan);
    border: 1px solid rgba(0, 217, 255, 0.2);
    background: rgba(0, 217, 255, 0.05);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.tech-card h3 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 23px;
    margin-bottom: 12px;
}

.tech-card p {
    color: var(--gray);
    font-size: 14px;
}

.card-line {
    position: absolute;
    left: 35px;
    bottom: 25px;
    width: 35px;
    height: 2px;
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
}

/* =========================================================
   PRODUCT SHOWCASE
========================================================= */

.product {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 80px;
    align-items: center;
}

.product-visual {
    min-height: 500px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 25px;
    overflow: hidden;
    background: radial-gradient(circle at center, rgba(20, 120, 255, 0.16), transparent 60%);
}

.product-visual::before {
    content: "";
    position: absolute;
    inset: 35px;
    border: 1px solid rgba(0, 217, 255, 0.13);
    border-radius: 20px;
    pointer-events: none;
}

.product-label {
    position: absolute;
    bottom: 25px;
    left: 30px;
    color: rgba(255, 255, 255, 0.35);
    font-size: 10px;
    letter-spacing: 3px;
    z-index: 4;
}

.robot-image {
    position: relative;
    z-index: 2;
    display: block;
    width: 82%;
    max-width: 500px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 30px rgba(20, 120, 255, 0.25));
    transition: transform .4s ease, filter .4s ease;
}

.product-visual:hover .robot-image {
    transform: scale(1.04);
    filter: drop-shadow(0 0 45px rgba(0, 217, 255, 0.35));
}

.scan-line {
    position: absolute;
    left: 15%;
    right: 15%;
    top: 20%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 217, 255, 0.7), transparent);
    box-shadow: 0 0 12px rgba(0, 217, 255, 0.5);
    opacity: .35;
    animation: scan 5s ease-in-out infinite;
    z-index: 3;
}

@keyframes scan {
    0% { top: 20%; opacity: 0; }
    20% { opacity: .5; }
    50% { top: 80%; opacity: .5; }
    80% { opacity: 0; }
    100% { top: 20%; opacity: 0; }
}

.corner {
    position: absolute;
    width: 20px;
    height: 20px;
    z-index: 4;
}

.corner-tl { top: 25px; left: 25px; border-top: 1px solid var(--cyan); border-left: 1px solid var(--cyan); }
.corner-tr { top: 25px; right: 25px; border-top: 1px solid var(--cyan); border-right: 1px solid var(--cyan); }
.corner-bl { bottom: 25px; left: 25px; border-bottom: 1px solid var(--cyan); border-left: 1px solid var(--cyan); }
.corner-br { bottom: 25px; right: 25px; border-bottom: 1px solid var(--cyan); border-right: 1px solid var(--cyan); }

.product-content h2 {
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(35px, 5vw, 58px);
    line-height: 1.05;
    letter-spacing: -2px;
}

.product-content p {
    margin-top: 20px;
    color: var(--gray);
}

.product-button {
    margin-top: 35px;
}

.specs {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 35px;
}

.spec {
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.015);
    transition: .3s;
}

.spec:hover {
    border-color: var(--border-bright);
    background: rgba(0, 217, 255, 0.03);
}

.spec strong {
    display: block;
    font-family: "Space Grotesk", sans-serif;
    font-size: 20px;
    color: white;
}

.spec span {
    color: var(--gray);
    font-size: 10px;
    letter-spacing: 1px;
}

/* =========================================================
   ENGINEERING PROJECTS GRID
========================================================= */

.engineering-section {
    background: linear-gradient(180deg, transparent, rgba(10, 30, 55, 0.2), transparent);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-top: 20px;
}

.project-card {
    background: linear-gradient(145deg, rgba(12, 16, 24, 0.95), rgba(0, 0, 0, 0.98));
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform 0.35s ease, border-color 0.35s ease, box-shadow 0.35s ease;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: rgba(0, 217, 255, 0.4);
    box-shadow: var(--glow-blue);
}

.project-image-box {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1; /* กำหนดกรอบการ์ดให้เป็น 1:1 ตามรูป */
    overflow: hidden;
    background: #05080c;
    display: flex;
    align-items: center;
    justify-content: center;
}

.project-img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* แสดงผลภาพครบทั้งภาพ 100% ไม่โดน Crop */
    transition: transform 0.5s ease;
}

.project-card:hover .project-img {
    transform: scale(1.06);
}

.project-tag {
    position: absolute;
    top: 15px;
    right: 15px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.85);
    border: 1px solid rgba(0, 217, 255, 0.3);
    border-radius: 999px;
    color: var(--cyan);
    font-size: 10px;
    letter-spacing: 1px;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
}

.project-info {
    padding: 25px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.project-info h3 {
    font-family: "Space Grotesk", sans-serif;
    font-size: 20px;
    color: var(--white);
    margin-bottom: 10px;
}

.project-info p {
    color: var(--gray);
    font-size: 13.5px;
    line-height: 1.5;
}

.engineering-cta {
    text-align: center;
    margin-top: 50px;
}

/* =========================================================
   STATS
========================================================= */

.stats-section {
    padding-top: 60px;
    padding-bottom: 60px;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat {
    padding: 40px 25px;
    border-right: 1px solid var(--border);
}

.stat:last-child {
    border-right: none;
}

.stat strong {
    display: block;
    font-family: "Space Grotesk", sans-serif;
    font-size: 38px;
    color: white;
}

.stat span {
    color: var(--gray);
    font-size: 10px;
    letter-spacing: 1px;
}

.about-section {
    padding-bottom: 100px;
}

/* =========================================================
   CONTACT & FOOTER
========================================================= */

.contact {
    position: relative;
    text-align: center;
    padding: 160px 8%;
    overflow: hidden;
}

.contact-glow {
    position: absolute;
    width: 600px;
    height: 300px;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(ellipse, rgba(20, 120, 255, 0.14), transparent 70%);
    pointer-events: none;
}

.contact h2 {
    position: relative;
    font-family: "Space Grotesk", sans-serif;
    font-size: clamp(40px, 6vw, 75px);
    line-height: 1;
    letter-spacing: -3px;
}

.contact p {
    position: relative;
    max-width: 600px;
    margin: 25px auto 35px;
    color: var(--gray);
}

footer {
    padding: 35px 8%;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    justify-content: space-between;
    color: var(--gray);
    font-size: 12px;
    background-color: #000000;
}

.footer-logo {
    font-family: "Space Grotesk", sans-serif;
    color: white;
}

/* =========================================================
   MEDIA QUERIES
========================================================= */

@media (max-width: 900px) {
    .nav {
        display: none;
        position: absolute;
        top: 76px;
        left: 0;
        right: 0;
        padding: 25px;
        flex-direction: column;
        gap: 20px;
        background: rgba(0, 0, 0, 0.98);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid var(--border);
    }

    .nav.mobile-open { display: flex; }
    .mobile-menu-button { display: block; }
    .hero { padding: 130px 7% 100px; }
    .hero h1 { letter-spacing: -3px; }
    .hero-tech { display: none; }
    .section { padding: 90px 7%; }
    .tech-grid { grid-template-columns: 1fr; }
    .product { grid-template-columns: 1fr; }
    .product-visual { min-height: 380px; }
    .projects-grid { grid-template-columns: repeat(2, 1fr); }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .stat:nth-child(2) { border-right: none; }
}

@media (max-width: 550px) {
    .navbar { padding: 0 5%; }
    .logo { font-size: 17px; }
    .hero { min-height: 90vh; padding: 120px 6% 80px; }
    .hero h1 { font-size: 48px; letter-spacing: -3px; }
    .hero-description { font-size: 16px; }
    .hero-buttons { flex-direction: column; align-items: stretch; }
    .btn { width: 100%; }
    .product-visual { min-height: 300px; border-radius: 18px; }
    .product-visual::before { inset: 20px; }
    .robot-image { width: 90%; }
    .specs { grid-template-columns: 1fr; }
    .projects-grid { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr; }
    .stat { border-right: none; border-bottom: 1px solid var(--border); }
    .stat:last-child { border-bottom: none; }
    footer { flex-direction: column; gap: 10px; }
}