/* ==========================================================================
   Aethel Automation - Production-Grade Custom Design System & Refinements
   Modern dark glassmorphic technology aesthetic with cyan/electric-blue accents.
   ========================================================================== */

/* --- Design Tokens --- */
:root {
  --color-blue-950: #0f172a;
  --color-blue-900: #1e3a8a;
  --color-blue-700: #1d4ed8;
  --color-blue-600: #2563eb;
  --color-blue-500: #3b82f6;
  --color-blue-400: #60a5fa;

  --color-cyan-500: #06b6d4;
  --color-cyan-400: #22d3ee;
  --color-cyan-300: #67e8f9;
  --color-cyan-200: #a5f3fc;

  --color-emerald-500: #10b981;
  --color-emerald-400: #34d399;

  --bg-deep: #070B14;
  --bg-surface: #0B1120;
  --bg-card: rgba(15, 23, 42, 0.72);

  --glass-border: rgba(59, 130, 246, 0.22);
  --glass-hover-border: rgba(34, 211, 238, 0.5);
  --glass-shadow: 0 16px 40px -12px rgba(2, 6, 23, 0.6);
  --glass-glow: 0 0 35px -8px rgba(34, 211, 238, 0.25);
}

/* ==========================================================================
   1. Interactive Buttons & Micro-Interactions
   ========================================================================== */

/* Primary Action Glow Button */
.btn-glow-primary {
  background: linear-gradient(135deg, #2563eb 0%, #0284c7 50%, #06b6d4 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.22) !important;
  box-shadow: 0 4px 20px -2px rgba(37, 99, 235, 0.45), 0 0 15px -1px rgba(6, 182, 212, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
  position: relative;
  overflow: hidden;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  min-height: 44px;
  cursor: pointer;
}

.btn-glow-primary:hover {
  background: linear-gradient(135deg, #1d4ed8 0%, #0369a1 50%, #0891b2 100%) !important;
  box-shadow: 0 8px 30px -4px rgba(37, 99, 235, 0.65), 0 0 25px 2px rgba(34, 211, 238, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.45) !important;
  transform: translateY(-2px);
}

.btn-glow-primary:active {
  transform: translateY(1px) scale(0.985);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.4) !important;
}

/* Shimmer Sweep Animation */
.btn-glow-primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  transform: skewX(-22deg);
  z-index: 1;
}

@media (prefers-reduced-motion: no-preference) {
  .btn-glow-primary:hover::after {
    animation: shimmerSweep 1.3s ease-in-out infinite;
  }
}

@keyframes shimmerSweep {
  0% { left: -100%; }
  100% { left: 220%; }
}

/* Secondary Button */
.btn-glow-secondary {
  background: rgba(15, 23, 42, 0.8) !important;
  color: #e2e8f0 !important;
  border: 1px solid rgba(59, 130, 246, 0.3) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-height: 44px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
  cursor: pointer;
}

.btn-glow-secondary:hover {
  background: rgba(30, 41, 59, 0.9) !important;
  border-color: rgba(34, 211, 238, 0.5) !important;
  color: #ffffff !important;
  box-shadow: 0 6px 24px -4px rgba(6, 182, 212, 0.25) !important;
  transform: translateY(-2px);
}

.btn-glow-secondary:active {
  transform: translateY(1px) scale(0.985);
}

/* ==========================================================================
   2. Two-Layer Material Architecture (Apple HIG liquid-glass.md)
      - Functional Layer: Floating navigation, modals, and cookie banner retain Liquid Glass blur.
      - Content Layer: Static content cards use high-performance opaque dark surfaces.
   ========================================================================== */

/* Functional Layer (Floating Chrome) */
.glass-nav {
  background: rgba(7, 11, 20, 0.88) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom: 1px solid rgba(59, 130, 246, 0.18) !important;
}

.cookie-banner-wrap .glass-panel,
div[role="dialog"] .glass-panel {
  background: rgba(11, 17, 32, 0.88) !important;
  backdrop-filter: blur(24px) !important;
  -webkit-backdrop-filter: blur(24px) !important;
  border: 1px solid rgba(59, 130, 246, 0.28) !important;
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.85) !important;
}

/* Content Layer (Opaque, High Performance) */
.glass-panel {
  background: #0B1120 !important;
  border: 1px solid var(--glass-border) !important;
  box-shadow: var(--glass-shadow) !important;
  position: relative;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, transform 0.25s ease;
}

.glass-panel-hover {
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.glass-panel-hover:hover {
  border-color: var(--glass-hover-border) !important;
  box-shadow: 0 16px 40px -10px rgba(6, 182, 212, 0.25), 0 0 25px -4px rgba(37, 99, 235, 0.3) !important;
  transform: translateY(-2px);
}

.glass-panel-active {
  border-color: rgba(34, 211, 238, 0.7) !important;
  box-shadow: 0 0 35px -4px rgba(6, 182, 212, 0.4) !important;
}

/* ==========================================================================
   3. Section Divider Glow Line
   ========================================================================== */

section[id] {
  position: relative;
  border-top: none !important;
}

section[id]::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(37, 99, 235, 0.4) 20%, rgba(34, 211, 238, 0.7) 50%, rgba(37, 99, 235, 0.4) 80%, transparent 100%);
  background-size: 200% 100%;
  z-index: 10;
  opacity: 0.75;
}

/* Static divider glow (perf): the gradient line is identical, but the 10s
   infinite background-position sweep repainted every section divider on every
   frame. Continuous full-width paints removed; line itself unchanged. */
@keyframes gradientBorderSweep {
  0% { background-position: 0% 0%; }
  100% { background-position: 100% 0%; }
}

/* ==========================================================================
   4. Audio Waveform Oscillate Animation (Voice Agent)
   ========================================================================== */

@keyframes waveOscillate {
  0%, 100% {
    height: 15%;
    opacity: 0.4;
  }
  50% {
    height: 98%;
    opacity: 1;
  }
}

/* ==========================================================================
   5. Fluid Typography & Mobile Responsive Hardening
   ========================================================================== */

/* Prevent Horizontal Overflow Globally */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Responsive Headings */
h1 {
  letter-spacing: -0.025em;
  line-height: 1.15;
}

h2 {
  letter-spacing: -0.025em;
  line-height: 1.2;
}

/* Ensure touch targets meet WCAG & Apple HIG standards (min 44px mobile, min 36px desktop) */
.ctrl-target:not(.hidden) {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Hidden utility without !important to allow responsive breakpoint overrides */
.hidden {
  display: none;
}

/* Ensure mobile header buttons with .hidden do not get overridden by .lg:hidden button from site.build.css */
@media (max-width: 639px) {
  .lg\:hidden button.hidden,
  .lg\:hidden a.hidden,
  header .hidden {
    display: none !important;
  }
}

@media (max-width: 640px) {
  .ctrl-target:not(.hidden),
  button:not(.hidden),
  a.btn-glow-primary:not(.hidden),
  a.btn-glow-secondary:not(.hidden),
  input,
  select {
    min-height: 44px !important;
  }

  .glass-panel {
    padding: 1.25rem !important;
  }

  /* Safe margins for phone viewports */
  main {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }
}

/* Custom Select Dropdown Styling (Apple HIG entering-data.md) */
.custom-select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2338bdf8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.15rem 1.15rem;
  padding-right: 2.75rem !important;
  cursor: pointer;
}

/* ==========================================================================
   6. Accessibility & Keyboard Focus
   ========================================================================== */

/* High-contrast focus state for keyboard users */
:focus-visible {
  outline: 2px solid #22d3ee !important;
  outline-offset: 3px !important;
  border-radius: 8px;
}

/* High Contrast Mode Support (Apple HIG accessibility.md) */
@media (prefers-contrast: more) {
  .glass-panel,
  .glass-nav,
  div[role="dialog"] .glass-panel {
    background: #070B14 !important;
    border: 2px solid #38bdf8 !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  .text-slate-400, .text-slate-500 {
    color: #e2e8f0 !important;
  }
}

/* Accessible Skip Navigation Link */
.skip-link {
  position: absolute;
  top: -60px;
  left: 16px;
  background: #2563eb;
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 8px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 700;
  font-size: 0.875rem;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  transition: top 0.2s ease;
  text-decoration: none;
}

.skip-link:focus {
  top: 16px;
}

/* ==========================================================================
   7. Cookie Consent Banner & Drawer Styles (Safe Area Insets)
   ========================================================================== */

.cookie-banner-wrap {
  position: fixed;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  left: 1.5rem;
  right: 1.5rem;
  max-width: 580px;
  margin: 0 auto;
  z-index: 60;
  animation: pmSlideFadeInTop 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@media (max-width: 640px) {
  .cookie-banner-wrap {
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    left: 1rem;
    right: 1rem;
  }
}

/* ==========================================================================
   8. Custom Sleek Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: #070B14;
}

::-webkit-scrollbar-thumb {
  background: #1e293b;
  border-radius: 4px;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

::-webkit-scrollbar-thumb:hover {
  background: #2563eb;
}

/* Custom Selection */
::selection {
  background-color: #2563eb !important;
  color: #ffffff !important;
}

/* ==========================================================================
   9. Prefers-Reduced-Motion
   ========================================================================== */

@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;
  }

  .btn-glow-primary::after,
  section[id]::before {
    animation: none !important;
  }
}

/* ==========================================================================
   10. Restored Utility Classes & Layout Hardening
   ========================================================================== */

/* Spacing & Gaps */
.gap-5 { gap: 1.25rem; }
.sm\:gap-2\.5 { gap: 0.625rem; }
.sm\:gap-3 { gap: 0.75rem; }
.space-y-6 > :not([hidden]) ~ :not([hidden]) {
  --tw-space-y-reverse: 0;
  margin-top: calc(1.5rem * (1 - var(--tw-space-y-reverse)));
  margin-bottom: calc(1.5rem * var(--tw-space-y-reverse));
}
.-mt-1 { margin-top: -0.25rem; }
.mt-1\.5 { margin-top: 0.375rem; }
.mt-2\.5 { margin-top: 0.625rem; }
.pb-5 { padding-bottom: 1.25rem; }
.py-12 { padding-top: 3rem; padding-bottom: 3rem; }

/* Responsive Spacing & Padding */
@media (min-width: 640px) {
  .sm\:inline-flex { display: inline-flex !important; }
  .sm\:p-7 { padding: 1.75rem; }
  .sm\:px-4 { padding-left: 1rem; padding-right: 1rem; }
  .sm\:py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
  .sm\:py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
  .sm\:pb-6 { padding-bottom: 1.5rem; }
  .sm\:text-base { font-size: 1rem; line-height: 1.5rem; }
  .sm\:text-6xl { font-size: 3.75rem; line-height: 1; }
  .sm\:h-5 { height: 1.25rem; }
  .sm\:w-5 { width: 1.25rem; }
  .sm\:h-9 { height: 2.25rem; }
}

@media (min-width: 768px) {
  .md\:h-10 { height: 2.5rem; }
}

@media (min-width: 1024px) {
  .lg\:flex { display: flex !important; }
  .lg\:hidden { display: none !important; }
  .lg\:grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Desktop Extra-Large Breakpoint (xl: >= 1280px) */
@media (min-width: 1280px) {
  .xl\:gap-8 { gap: 2rem; }
  .xl\:gap-7 { gap: 1.75rem; }
  .xl\:gap-6 { gap: 1.5rem; }
  .xl\:gap-3 { gap: 0.75rem; }
  .xl\:text-sm { font-size: 0.875rem; line-height: 1.25rem; }
  .xl\:px-5 { padding-left: 1.25rem; padding-right: 1.25rem; }
  .xl\:px-3\.5 { padding-left: 0.875rem; padding-right: 0.875rem; }
  .xl\:py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
  .xl\:py-2\.5 { padding-top: 0.625rem; padding-bottom: 0.625rem; }
  .xl\:w-4 { width: 1rem; }
  .xl\:h-4 { height: 1rem; }
}

/* Dimensions & Overflow Limits */
.w-10 { width: 2.5rem; }
.max-h-\[320px\] { max-height: 320px; }
.max-h-\[calc\(100vh-80px\)\] { max-height: calc(100vh - 80px); }
.min-h-\[36px\] { min-height: 36px; }
.min-h-\[38px\] { min-height: 38px; }
.min-h-\[44px\] { min-height: 44px; }
.min-h-\[48px\] { min-height: 48px; }
.min-w-\[36px\] { min-width: 36px; }

/* Micro-Animations */
@keyframes pulseGlow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.96); }
}
.animate-pulse {
  animation: pulseGlow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes spinInfinite {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
.animate-spin {
  animation: spinInfinite 1s linear infinite;
}

@keyframes slideInFromTop3 {
  from { opacity: 0; transform: translateY(-0.75rem); }
  to { opacity: 1; transform: translateY(0); }
}
.slide-in-from-top-3 {
  animation: slideInFromTop3 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Color & Border Utilities */
.border-cyan-400\/40 { border-color: rgba(34, 211, 238, 0.4); }
.hover\:border-cyan-400\/40:hover { border-color: rgba(34, 211, 238, 0.4); }
.border-red-500\/30 { border-color: rgba(239, 68, 68, 0.3); }
.border-slate-800\/60 { border-color: rgba(30, 41, 59, 0.6); }
.bg-red-950\/40 { background-color: rgba(69, 10, 10, 0.4); }
.bg-slate-900\/40 { background-color: rgba(15, 23, 42, 0.4); }
.opacity-25 { opacity: 0.25; }

/* Box Shadows */
.shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05); }
.shadow-\[0_0_40px_-15px_rgba\(6\2c 182\2c 212\2c 0\.4\)\] {
  box-shadow: 0 0 40px -15px rgba(6, 182, 212, 0.4);
}
.shadow-\[0_12px_40px_rgba\(0\2c 0\2c 0\2c 0\.8\)\] {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.8);
}
.backdrop-blur-2xl {
  -webkit-backdrop-filter: blur(40px);
  backdrop-filter: blur(40px);
}

/* Form Focus Ring Utilities */
.focus\:ring-2:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(34, 211, 238, 0.7);
}
.focus\:ring-cyan-400:focus {
  --tw-ring-color: rgba(34, 211, 238, 0.8);
}
.focus\:ring-offset-2:focus {
  box-shadow: 0 0 0 2px #070b14, 0 0 0 4px rgba(34, 211, 238, 0.8);
}
.focus\:ring-offset-slate-900:focus {
  --tw-ring-offset-color: #0f172a;
}

/* ==========================================================================
   11. Performance Optimization & Modal Scroll Locking
   ========================================================================== */

/* Prevent background jitter/scroll when modals or mobile nav drawer are open */
body.modal-open {
  overflow: hidden !important;
  touch-action: none !important;
}

/* Ambient cloud rendering GPU optimization */
.pm-cloud-layer {
  filter: blur(45px) !important;
  contain: strict;
}

@media (max-width: 640px) {
  .pm-cloud-layer {
    filter: blur(28px) !important;
    animation: none !important; /* Eliminate continuous compositor invalidations on mobile */
  }
}

