/* ============================================
   SCADAPEX - Custom Styles
   Industrial Automation & SCADA Solutions
   ============================================ */

/* --- Font: Plus Jakarta Sans (more authoritative B2B feel) --- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&display=swap');

/* --- CSS Custom Properties --- */
:root {
  --brand-primary: #1e40af;
  --brand-dark: #0f172a;
  --brand-accent: #f97316;
  --brand-accent-hover: #ea580c;
  --brand-light: #f8fafc;
  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --border-color: #e2e8f0;
  --transition-speed: 300ms;
}

/* --- Base Reset & Typography --- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* --- Global Focus Visible (WCAG 2.4.7 AA) --- */
:focus-visible {
  outline: 2px solid var(--brand-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* --- Hero Video Background --- */
.hero-video-container {
  position: relative;
  overflow: hidden;
  min-height: 90vh;
}
.hero-video-container video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  z-index: 0;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 1;
}
.hero-content {
  position: relative;
  z-index: 2;
}

/* --- Mega Menu (CSS Hover, not click) --- */
.mega-menu-trigger { position: relative; }
.mega-menu-panel {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  width: 720px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--transition-speed) ease, visibility var(--transition-speed) ease;
  z-index: 50;
  padding-top: 0.5rem;
}
.mega-menu-trigger:hover .mega-menu-panel,
.mega-menu-panel:hover {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.mega-menu-trigger:hover > a,
.mega-menu-trigger:focus-within > a {
  color: var(--brand-accent) !important;
}
.mega-menu-card {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-radius: 0.5rem;
  background: #f1f5f9;
  transition: background var(--transition-speed) ease;
  text-decoration: none;
  color: var(--text-primary);
  cursor: pointer;
}
.mega-menu-card:hover {
  background: #e2e8f0;
}
.mega-menu-card .card-icon {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-primary);
}
.mega-menu-card .card-text h4 {
  font-weight: 600;
  font-size: 0.875rem;
  margin: 0 0 0.125rem;
  color: var(--brand-dark);
}
.mega-menu-card .card-text p {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

/* --- Mega Menu CTA Block --- */
.mega-menu-cta {
  background: linear-gradient(135deg, var(--brand-primary), #1d4ed8);
  border-radius: 0.5rem;
  padding: 1.5rem;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* --- Mobile Menu --- */
.mobile-menu {
  position: fixed;
  inset: 0;
  background: white;
  z-index: 100;
  transform: translateX(100%);
  transition: transform var(--transition-speed) ease;
  overflow-y: auto;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 400ms ease;
}
.mobile-submenu.open { max-height: 1000px; }

/* --- Section Styling --- */
.section-title {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--brand-dark);
}
.section-subtitle {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 640px;
}

/* --- Stats Bar --- */
.stat-item {
  text-align: center;
  padding: 1.5rem 1.25rem;
}
.stat-icon {
  width: 2.25rem;
  height: 2.25rem;
  margin: 0 auto 0.6rem;
  color: var(--brand-accent);
  opacity: 0.85;
}
.stat-number {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--brand-dark);
  line-height: 1;
}
.stat-label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 0.3rem;
}
.stat-context {
  font-size: 0.7rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  font-style: italic;
}

/* --- Pain Point Cards (problem statement section) --- */
.pain-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  transition: background var(--transition-speed) ease, border-color var(--transition-speed) ease;
  cursor: default;
}
.pain-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(249,115,22,0.35);
}
.pain-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.5rem;
  background: rgba(249,115,22,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand-accent);
  flex-shrink: 0;
}

/* --- Testimonial Cards --- */
.testimonial-card {
  background: white;
  border-radius: 1rem;
  padding: 2rem;
  border: 1px solid var(--border-color);
  position: relative;
  display: flex;
  flex-direction: column;
  transition: box-shadow var(--transition-speed) ease;
}
.testimonial-card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.08);
}
.testimonial-quote-mark {
  font-size: 4rem;
  line-height: 1;
  color: var(--brand-accent);
  opacity: 0.2;
  font-family: Georgia, serif;
  margin-bottom: -1rem;
  display: block;
}
.testimonial-stars {
  display: flex;
  gap: 2px;
  margin-bottom: 0.75rem;
}
.testimonial-star {
  width: 1rem;
  height: 1rem;
  color: #f59e0b;
  fill: currentColor;
}
.testimonial-metric {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.625rem;
  margin-bottom: 0.75rem;
}

/* ========================================================
   --- Methodology Steps (Advanced Animation & Alignment) --- 
   ======================================================== */
.method-steps-grid { position: relative; }

@keyframes marching-ants {
  from { background-position: 0 0; }
  to { background-position: 16px 0; } /* Positive value moves the dashed line Left-to-Right */
}

/* Stack cards in reverse order so the ::after line from Card 1 paints perfectly OVER Card 2's background */
.method-step:nth-child(1) { z-index: 3; }
.method-step:nth-child(2) { z-index: 2; }
.method-step:nth-child(3) { z-index: 1; }

.method-step {
  position: relative;
  padding: 2rem;
  border-radius: 0.75rem;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.method-step:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(249,115,22,0.4);
  transform: translateY(-8px);
  box-shadow: 0 20px 40px -10px rgba(249,115,22,0.15);
  z-index: 10; /* Hovered card pops to the very front */
}

/* Animated Dashed Line bridging the cards directly */
@media (min-width: 768px) {
  .method-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 3.45rem; /* Center of the circle (2rem padding + 1.5rem half-circle) */
    left: 6rem; /* 2rem padding + 3rem circle + 1rem gap */
    width: calc(100% - 3rem); /* Spans remaining card width + gap + 1rem into next card */
    height: 2px;
    background-image: linear-gradient(to right, rgba(249,115,22,0.6) 50%, transparent 50%);
    background-size: 16px 2px;
    background-repeat: repeat-x;
    animation: marching-ants 1s linear infinite;
    pointer-events: none;
  }
}

.method-step-number {
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--brand-accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.25rem;
  margin-bottom: 1.5rem;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
  box-shadow: 0 0 0 6px var(--brand-dark), 0 0 15px rgba(249,115,22,0.3);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
}

.method-step:hover .method-step-number {
  transform: scale(1.1);
  box-shadow: 0 0 0 6px var(--brand-dark), 0 0 25px rgba(249,115,22,0.7);
}

.method-step-content {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

/* Ensure titles are perfectly aligned regardless of 1 or 2 lines */
.method-step-content h3 {
  min-height: 3.5rem;
  display: flex;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

/* Forces the paragraph to take up all empty middle space, pushing checklists seamlessly to the bottom */
.method-step-content p {
  flex-grow: 1;
  margin-bottom: 1.5rem;
}

.method-step-list {
  margin-top: 0;
}
/* ======================================================== */


/* --- Service / Industry Cards --- */
.service-card, .industry-card {
  border-radius: 0.75rem;
  overflow: hidden;
  background: white;
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-speed) ease, border-color var(--transition-speed) ease;
  cursor: pointer;
}
.service-card:hover, .industry-card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
  border-color: rgba(249,115,22,0.3);
}
.service-card .card-icon-wrapper {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #334155;
}

/* --- CTA Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: var(--brand-accent);
  color: white;
  font-weight: 700;
  border-radius: 0.5rem;
  transition: background var(--transition-speed) ease, transform 150ms ease;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-size: 0.9375rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.btn-primary:hover {
  background: var(--brand-accent-hover);
  transform: translateY(-1px);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: transparent;
  color: white;
  font-weight: 600;
  border-radius: 0.5rem;
  border: 2px solid rgba(255,255,255,0.4);
  transition: all var(--transition-speed) ease;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9375rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: white;
}
.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.75rem;
  background: transparent;
  color: var(--brand-primary);
  font-weight: 600;
  border-radius: 0.5rem;
  border: 2px solid var(--brand-primary);
  transition: all var(--transition-speed) ease;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9375rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
}
.btn-outline:hover {
  background: var(--brand-primary);
  color: white;
}

/* --- Video Embed Responsive --- */
.video-embed {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 0.75rem;
  box-shadow: 0 8px 30px rgba(0,0,0,0.12);
}
.video-embed iframe,
.video-embed video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- Page Hero (for inner pages) --- */
.page-hero {
  background: linear-gradient(135deg, var(--brand-dark) 0%, #1e3a5f 100%);
  padding: 7rem 0 4rem;
  color: white;
}

/* --- Footer --- */
.site-footer {
  background: var(--brand-dark);
  color: #94a3b8;
}
.site-footer a {
  color: #94a3b8;
  text-decoration: none;
  transition: color var(--transition-speed) ease;
}
.site-footer a:hover { color: white; }

/* --- Form Inputs --- */
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.9375rem;
  transition: border-color var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
  background: white;
  color: var(--text-primary);
}
.form-input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15);
}

/* --- Scroll to top --- */
.scroll-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--brand-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-speed) ease;
  z-index: 40;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.scroll-top.visible { opacity: 1; visibility: visible; }
.scroll-top:hover { background: var(--brand-accent); transform: translateY(-2px); }

/* --- Certification Logos --- */
.cert-logo {
  transition: filter 0.3s ease, opacity 0.3s ease, transform 0.3s ease;
}
.cert-logo-wrapper:hover .cert-logo {
  filter: grayscale(0%);
  opacity: 1;
  transform: scale(1.05);
}

/* --- Team Member Cards --- */
.team-card {
  border-radius: 0.75rem;
  overflow: hidden;
  background: white;
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-speed) ease;
}
.team-card:hover {
  box-shadow: 0 12px 40px rgba(0,0,0,0.1);
}
.team-avatar {
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: white;
  flex-shrink: 0;
}
.cert-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #dbeafe;
}

/* --- Values Grid --- */
.value-card {
  padding: 2rem;
  border-radius: 0.75rem;
  background: white;
  border: 1px solid var(--border-color);
  transition: box-shadow var(--transition-speed) ease;
}
.value-card:hover {
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}
.value-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
}

/* --- Scroll Animations --- */
.animate-on-scroll {
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js-anim-ready .animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
}
.js-anim-ready .animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Accessibility: Respect reduced motion preference --- */
@media (prefers-reduced-motion: reduce) {
  .animate-on-scroll,
  .js-anim-ready .animate-on-scroll {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
  .method-step::after { display: none; }
}

/* --- Responsive Adjustments --- */
@media (max-width: 768px) {
  .hero-video-container { min-height: 80vh; }
  .mega-menu-panel { display: none !important; }
  .page-hero { padding: 6rem 0 3rem; }
}