/* Custom Styles - Dark Theme Inspired by Connect Management - Enhanced */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap');

/* ==================== CSS Variables ==================== */
:root {
  --color-black: #000000;
  --color-white: #ffffff;
  --color-gray-900: #0a0a0a;
  --color-gray-800: #1a1a1a;
  --color-gray-700: #2a2a2a;
  --color-gray-500: #6a6a6a;
  --ease-out-quart: cubic-bezier(0.165, 0.84, 0.44, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: #000000;
  color: #ffffff;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
  background: #2a2a2a;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3a3a;
}

/* Text Selection */
::selection {
  background: #ffffff;
  color: #000000;
}

::-moz-selection {
  background: #ffffff;
  color: #000000;
}

/* Counter Digits Animation */
.counter-digit {
  display: inline-block;
  transition: all 0.3s ease;
}

.counter-digit.active {
  animation: flipNumber 0.6s ease;
}

@keyframes flipNumber {
  0% {
    transform: rotateX(0deg);
    opacity: 0;
  }
  50% {
    transform: rotateX(90deg);
    opacity: 0.5;
  }
  100% {
    transform: rotateX(0deg);
    opacity: 1;
  }
}

/* Service Items Hover Effect */
.service-item {
  position: relative;
  overflow: hidden;
}

.service-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 100%;
  background: #1a1a1a;
  transition: width 0.3s ease;
  z-index: -1;
}

.service-item:hover::before {
  width: 100%;
}

/* Work Card Animations */
.work-card {
  transition: all 0.3s ease;
}

.work-card:hover {
  transform: translateY(-4px);
}

/* FAQ Accordion */
.faq-item {
  transition: all 0.3s ease;
}

.faq-item.active .faq-question svg {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.3s ease;
}

.faq-answer.show {
  max-height: 500px;
  padding-bottom: 1.5rem;
}

/* Fade In Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.fade-in-up {
  animation: fadeInUp 0.8s ease-out forwards;
}

.fade-in {
  animation: fadeIn 0.8s ease-out forwards;
}

/* Stagger Animation Delays */
.service-item:nth-child(1) { animation-delay: 0.1s; }
.service-item:nth-child(2) { animation-delay: 0.2s; }
.service-item:nth-child(3) { animation-delay: 0.3s; }
.service-item:nth-child(4) { animation-delay: 0.4s; }
.service-item:nth-child(5) { animation-delay: 0.5s; }

/* Image Hover Effects */
img {
  transition: transform 0.5s ease;
}

/* Link Hover Effects */
a {
  transition: all 0.3s ease;
}

/* Button Styles */
button, a[class*="bg-white"] {
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

button::before, a[class*="bg-white"]::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.1);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

button:active::before, a[class*="bg-white"]:active::before {
  width: 300px;
  height: 300px;
}

/* Mobile Menu Animation */
#mobile-menu {
  animation: slideDown 0.3s ease-out;
}

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

/* Reveal on Scroll */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Tabular Numbers for Counters */
.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Smooth Transitions */
* {
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Gradient Text */
.gradient-text {
  background: linear-gradient(135deg, #ffffff 0%, #6a6a6a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Border Glow Effect */
.border-glow {
  position: relative;
}

.border-glow::after {
  content: '';
  position: absolute;
  inset: -1px;
  background: linear-gradient(90deg, transparent, #ffffff, transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: -1;
  animation: borderGlow 3s linear infinite;
}

.border-glow:hover::after {
  opacity: 0.3;
}

@keyframes borderGlow {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

/* Loading State */
.loading {
  position: relative;
  overflow: hidden;
}

.loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  animation: loading 1.5s infinite;
}

@keyframes loading {
  to {
    left: 100%;
  }
}

/* Utility Classes */
.text-balance {
  text-wrap: balance;
}

/* Focus Styles */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 4px;
}

/* Improved Readability */
p, li {
  max-width: 65ch;
}

/* Responsive Typography */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 1920px) {
  html {
    font-size: 18px;
  }
}

/* Performance Optimizations */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }
  
  nav, footer, #page-loader, #scroll-progress, #back-to-top, .custom-cursor {
    display: none !important;
  }
}

/* ==================== New Enhancement Styles ==================== */

/* Link Hover Underline Animation */
a:not([class*="bg-"]) {
  position: relative;
}

a:not([class*="bg-"])::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s ease;
}

a:not([class*="bg-"]):hover::after {
  width: 100%;
}

/* Form Input Focus States */
input:focus,
textarea:focus,
select:focus {
  border-color: var(--color-white) !important;
  box-shadow: 0 0 0 1px var(--color-white);
}

input::placeholder,
textarea::placeholder {
  color: var(--color-gray-500);
  opacity: 0.6;
}

/* Button Press Animation */
button:active,
a[class*="bg-"]:active {
  transform: scale(0.98);
}

/* Loading Animation for Form Button */
button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
  }
  50% {
    opacity: 0.8;
  }
}

/* Success/Error Messages */
#form-success,
#form-error {
  animation: slideInUp 0.3s ease-out;
}

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

/* Back to Top Button Hover */
#back-to-top:hover {
  transform: translateY(-2px) scale(1.1);
  box-shadow: 0 8px 20px rgba(255, 255, 255, 0.3);
}

/* Page Loader */
#page-loader {
  transition: opacity 0.3s ease;
}

/* Scroll Progress Bar */
#scroll-progress {
  background: linear-gradient(90deg, var(--color-white), var(--color-gray-500));
}

/* Service Item Enhanced Hover */
.service-item {
  cursor: pointer;
}

.service-item::before {
  transition: width 0.4s var(--ease-out-quart);
}

.service-item:hover h3 {
  transform: translateX(4px);
  transition: transform 0.3s ease;
}

/* Image Container Hover Effect */
.aspect-\[4\/3\] {
  position: relative;
  overflow: hidden;
}

.aspect-\[4\/3\]::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.3));
  opacity: 0;
  transition: opacity 0.3s ease;
}

.work-card:hover .aspect-\[4\/3\]::after {
  opacity: 1;
}

/* Form Field Animation */
input,
textarea,
select {
  transition: all 0.3s ease;
}

input:focus,
textarea:focus,
select:focus {
  transform: translateY(-2px);
}

/* Footer Links Hover */
footer a {
  position: relative;
  display: inline-block;
}

footer a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.3s ease;
}

footer a:hover::after {
  width: 100%;
}

/* Social Icon Animations */
footer .fab {
  transition: transform 0.3s ease;
}

footer a:hover .fab {
  transform: scale(1.2) rotate(5deg);
}

/* Skeleton Loading for Images */
.aspect-\[4\/3\] {
  background: linear-gradient(
    90deg,
    var(--color-gray-900) 0%,
    var(--color-gray-800) 50%,
    var(--color-gray-900) 100%
  );
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
}

@keyframes skeleton {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

.aspect-\[4\/3\]:has(img[src]) {
  background: var(--color-gray-900);
  animation: none;
}

/* Text Selection Enhancement */
::selection {
  background: var(--color-white);
  color: var(--color-black);
  text-shadow: none;
}

/* Mobile Menu Animation Enhancement */
#mobile-menu {
  animation: slideDown 0.3s var(--ease-out-quart);
}

/* Improved Accessibility: Focus Indicators */
*:focus-visible {
  outline: 2px solid var(--color-white);
  outline-offset: 4px;
  border-radius: 2px;
}

/* Remove focus outline for mouse users */
*:focus:not(:focus-visible) {
  outline: none;
}

/* Improve Readability: Text Rendering */
body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern" 1, "liga" 1;
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  #page-loader {
    display: none !important;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  body {
    background: #000000;
    color: #ffffff;
  }
  
  .text-gray-400,
  .text-gray-500 {
    color: #cccccc !important;
  }
}
