/* Reset and Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --color-bg: #0a0a0a;
  --color-primary: #ff6b6b; /* brand accent (K + buttons) */
  --color-secondary: #ffd93d; /* warm highlight for gradients */
  --color-text: #ffffff; /* primary text on dark */
  --color-text-light: #b0b0b0;
  --color-white: #ffffff;
  --color-card-bg: #1a1a1a;

  --font-primary: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, sans-serif;

  /* Hero gradient colors - dark subtle gradient */
  --hero-gradient-1: #0a0a0a;
  --hero-gradient-2: #1a1a1a;
  --hero-gradient-3: #0f0f0f;
  --hero-gradient-4: #0a0a0a;

  /* Section background colors */
  --section-bg: #0a0a0a;
  --section-bg-alt: #0f0f0f;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* Animations */
@keyframes gradientShift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes navDrop {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes glowPulse {
  0% {
    box-shadow: 0 0 0 rgba(255, 255, 255, 0);
    filter: drop-shadow(0 0 0 rgba(255, 255, 255, 0));
  }
  100% {
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.45);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.45));
  }
}

/* Navigation */
.nav {
  animation: navDrop 0.6s ease 0.1s both;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: 2rem 3rem;
  display: flex;
  justify-content: space-between;
  align-items: center;

  /* Option 1: subtle top fade for contrast while staying "transparent" */
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0));
  backdrop-filter: none;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}

.logo-text {
  font-family: "Montserrat", var(--font-primary);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-white);
  /* readability on busy backgrounds */
  text-shadow: 0 0 12px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(0, 0, 0, 0.25);
}

.logo-k {
  font-family: "Montserrat", var(--font-primary);
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-right: 0.15rem;
  color: var(--color-primary);
}

/* Hamburger */
.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.menu-toggle span {
  width: 30px;
  height: 2px;
  background: #ffffff; /* white by default */
  transition: all 0.3s ease;
  border-radius: 2px;
}

.menu-toggle:hover span,
.menu-toggle:focus-visible span {
  /* white with glow pulse on hover/focus */
  background: #ffffff;
  animation: glowPulse 1.2s ease-in-out infinite alternate;
}

.menu-toggle:hover {
  transform: scale(1.03);
}
.menu-toggle:active {
  transform: scale(0.98);
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(8px, 8px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Menu */
.mobile-menu {
  position: fixed;
  top: 0;
  right: -100%;
  width: 280px;
  height: 100vh;
  background: rgba(10, 10, 10, 0.98);
  backdrop-filter: blur(10px);
  z-index: 999;
  transition: right 0.3s ease;
  border-left: 1px solid rgba(255, 107, 107, 0.2);
}

.mobile-menu.active {
  right: 0;
}

.mobile-menu-content {
  display: flex;
  flex-direction: column;
  padding: 6rem 2rem 2rem;
  gap: 1rem;
}

.mobile-menu-item {
  color: var(--color-text);
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 500;
  padding: 1rem;
  border-radius: 8px;
  transition: all 0.3s ease;
  border: 1px solid transparent;
}

.mobile-menu-item:hover,
.mobile-menu-item:focus {
  background: rgba(255, 107, 107, 0.1);
  border-color: rgba(255, 107, 107, 0.3);
  color: var(--color-primary);
  transform: translateX(-5px);
}

/* Hero Section */
.hero {
  position: relative;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    var(--hero-gradient-1),
    var(--hero-gradient-2),
    var(--hero-gradient-3),
    var(--hero-gradient-4)
  );
  background-size: 400% 400%;
  animation: gradientShift 15s ease infinite;
  transition: background 0.8s ease;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 50%,
    rgba(255, 107, 107, 0.1),
    transparent 70%
  );
  pointer-events: none;
  z-index: 1;
}

#matrixCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
}

.hero-content {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 2rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: 8rem; /* Shift to the right to balance with matrix grid */
}

@media (max-width: 1200px) {
  .hero-content {
    margin-right: 4rem; /* Less shift on smaller screens */
  }
}

@media (max-width: 768px) {
  .hero-content {
    max-width: 90%;
    margin: 0 auto; /* Center on mobile */
  }

  .hero-subtitle {
    min-height: 4em; /* More space on mobile for potential wrapping */
  }
}

.hero-title {
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text);
  margin: 0 0 2rem 0;
  letter-spacing: -0.02em;
  animation: fadeInUp 1s ease-out;
}

.hero-subtitle {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  font-weight: 300;
  line-height: 1.6;
  color: var(--color-text-light);
  margin: 0 0 2rem 0;
  animation: fadeInUp 1s ease-out 0.2s backwards;
  min-height: 3.2em; /* Reserve space for 2 lines to prevent button jumping */
  display: flex;
  align-items: center;
  justify-content: center;
}

.hero-button {
  animation: fadeInUp 1s ease-out 0.4s backwards;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Sections */
.section {
  padding: 5rem 2rem;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.8s ease, transform 0.8s ease;
  background: linear-gradient(
    180deg,
    var(--section-bg) 0%,
    var(--section-bg-alt) 50%,
    var(--section-bg) 100%
  );
}

.section.fade-in {
  opacity: 1;
  transform: translateY(0);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 400;
  line-height: 1.3;
  margin-bottom: 2rem;
  color: var(--color-text);
  letter-spacing: -0.02em;
}

.section-text {
  font-size: clamp(1.1rem, 2vw, 1.4rem);
  line-height: 1.8;
  color: var(--color-text-light);
  max-width: 800px;
  margin: 0 auto;
}

/* About Section */
.about {
  text-align: center;
}

/* Why AI Section */
.why-ai {
  background: var(--section-bg);
  text-align: center;
}

.benefits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.benefit-card {
  background: var(--color-card-bg);
  padding: 2.5rem 2rem;
  border-radius: 20px;
  transition: all 0.4s ease;
  border: 1px solid rgba(255, 107, 107, 0.15);
  text-align: center;
}

.benefit-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 15px 35px rgba(255, 107, 107, 0.25);
  border-color: rgba(255, 107, 107, 0.4);
  background: #1f1f1f;
}

.benefit-icon {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.benefit-icon svg {
  width: 48px;
  height: 48px;
  color: var(--color-primary);
  transition: all 0.3s ease;
}

.benefit-card:hover .benefit-icon svg {
  color: var(--color-secondary);
  transform: scale(1.15);
}

.benefit-title {
  font-size: 1.4rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.benefit-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-light);
}

/* Services Section */
.services {
  background: #0a0a0a;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 4rem;
}

.service-card {
  background: var(--color-card-bg);
  padding: 3rem 2rem;
  border-radius: 20px;
  transition: all 0.4s ease;
  border: 1px solid rgba(255, 107, 107, 0.2);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.service-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 20px 40px rgba(255, 107, 107, 0.3);
  border-color: var(--color-primary);
  background: #222;
}

.service-icon {
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.service-icon svg {
  width: 48px;
  height: 48px;
  color: var(--color-primary);
  transition: all 0.3s ease;
}
.service-card:hover .service-icon svg {
  color: var(--color-secondary);
  transform: scale(1.1);
}

.service-title {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}
.service-description {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-light);
}

/* Approach Section */
.approach {
  background: var(--color-bg);
}

/* Mission & Values Section */
.mission-values {
  background: var(--section-bg-alt);
  text-align: center;
}

.mission-statement {
  max-width: 900px;
  margin: 2rem auto 4rem;
  padding: 2.5rem;
  background: rgba(255, 107, 107, 0.05);
  border-radius: 20px;
  border: 1px solid rgba(255, 107, 107, 0.2);
}

.mission-text {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.8;
  color: var(--color-text-light);
  margin: 0;
}

.values-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
  margin-top: 3rem;
}

.value-card {
  flex: 0 1 calc(33.333% - 1.5rem);
  min-width: 220px;
  max-width: 280px;
  background: var(--color-card-bg);
  padding: 2rem 1.5rem;
  border-radius: 15px;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 107, 107, 0.1);
}

.value-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 25px rgba(255, 107, 107, 0.2);
  border-color: rgba(255, 107, 107, 0.3);
}

.value-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  filter: grayscale(0.3);
  transition: all 0.3s ease;
}

.value-card:hover .value-icon {
  filter: grayscale(0);
  transform: scale(1.1);
}

.value-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: var(--color-text);
}

.value-text {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--color-text-light);
}

.approach-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 3rem;
  margin-top: 4rem;
}

.approach-item {
  transition: opacity 0.8s ease, transform 0.8s ease;
}
.approach-number {
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-primary);
  opacity: 0.3;
  margin-bottom: 1rem;
}
.approach-title {
  font-size: 1.8rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}
.approach-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--color-text-light);
}

/* Contact Section */
.contact {
  text-align: center;
  padding: 5rem 2rem;
}

.contact-text {
  font-size: clamp(1.1rem, 2vw, 1.3rem);
  line-height: 1.8;
  color: var(--color-text-light);
  max-width: 700px;
  margin: 2rem auto 3rem;
}

.contact-button {
  display: inline-block;
  padding: 1.2rem 3rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-white);
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-secondary)
  );
  border: none;
  border-radius: 50px;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(255, 107, 107, 0.3);
  cursor: pointer;
  font-family: var(--font-primary);
}

.contact-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 40px rgba(255, 107, 107, 0.4);
}

/* Footer */
.footer {
  padding: 3rem 2rem;
  text-align: center;
  background: var(--color-bg);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.footer-text {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav {
    padding: 1.5rem 1.5rem;
  }

  .logo-text {
    font-size: 0.85rem;
  }

  .hero {
    min-height: 100vh;
    height: auto;
  }

  .hero-title {
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
  }

  .hero-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
  }

  .section {
    padding: 3.5rem 1.5rem;
  }

  .section-title {
    font-size: 2rem;
  }

  .services-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .service-card {
    padding: 2rem 1.5rem;
  }

  .approach-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .benefits-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .benefit-card {
    padding: 2rem 1.5rem;
  }

  .mission-statement {
    padding: 2rem 1.5rem;
  }

  .values-grid {
    flex-direction: column;
    gap: 1.5rem;
  }

  .value-card {
    flex: 1 1 100%;
    max-width: 100%;
  }

  /* Better touch targets */
  .contact-button,
  .hero-button {
    min-height: 48px;
    touch-action: manipulation;
  }

  .menu-toggle {
    min-width: 44px;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .nav {
    padding: 1rem 1rem;
  }

  .nav-logo {
    gap: 0.5rem;
  }

  .logo-icon {
    width: 32px;
    height: 32px;
  }

  .logo-text {
    font-size: 0.75rem;
  }

  .logo-k {
    font-size: 1rem;
  }

  .hero-content {
    padding: 1.5rem;
  }

  .hero-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .section {
    padding: 2.5rem 1rem;
  }

  .section-title {
    font-size: 1.6rem;
  }

  .section-text {
    font-size: 1rem;
  }

  .contact-button,
  .hero-button {
    padding: 1rem 2rem;
    font-size: 1rem;
    width: 100%;
    max-width: 280px;
  }

  .approach-number {
    font-size: 2.5rem;
  }

  .approach-title {
    font-size: 1.5rem;
  }
}

/* Smooth Transitions */
* {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Selection Color */
::selection {
  background: var(--color-primary);
  color: var(--color-white);
}
::-moz-selection {
  background: var(--color-primary);
  color: var(--color-white);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-secondary)
  );
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-primary);
}

/* (If you have any debug control panels, keep these hovers) */
#layerControls button:hover {
  background: #ff8c42 !important;
  transform: scale(1.1);
}
#layerControls button:active {
  transform: scale(0.95);
}
#targetControls button:hover {
  opacity: 0.8;
  transform: scale(1.05);
}
#targetControls button:active {
  transform: scale(0.95);
}
#resetTarget:hover {
  background: #45b7af !important;
}
