/* ========================================
   CarSense Landing Page Styles
   ======================================== */

/* CSS Variables */
:root {
  --cream: #cccccc;
  --bg: #02487e;          
  --ink: #1A1A1A;            
  --navy: #0A2463;           
  --blue: #3E78B2;           
  --silver: #C8D3D5;         
  --charcoal: #2E3440;       
  --slate: #4D5B6A;           
  --shadow: #00000033;
  
  --ru: clamp(16px, 4vw, 32px);
  --stroke: clamp(6px, 1.2vw, 10px); 
  --cap: 0.72em; 
}

/* Base Styles */
html, 
body { 
  height: 100%; 
}

body {
  font-family: "Rubik", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: var(--cream) !important;
}

/* Grain Texture Effect */
.grain:before {
  content: "";
  position: fixed; 
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(#00000010 1px, transparent 1px),
    radial-gradient(#00000008 1px, transparent 1px);
  background-size: 3px 3px, 5px 5px;
  mix-blend-mode: multiply;
  opacity: .35;
}

/* Blob Effect */
.blob {
  filter: drop-shadow(0 8px 14px var(--shadow));
  mask-image: radial-gradient(80% 80% at 50% 50%, #000 60%, rgba(0,0,0,0.6) 75%, rgba(0,0,0,0));
}

/* Road/Path Styles */
.road path {
  stroke: var(--ink);
  stroke-width: var(--stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.4));
}

/* Button Styles */
.poster-btn {
  position: relative;
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  padding: calc(var(--ru)*.6) calc(var(--ru)*1.2);
  font-weight: 700;
  letter-spacing: -0.01em;
  border: var(--stroke) solid var(--ink);
  border-radius: 999px; 
  box-shadow: 0 2px 0 #00000040;
  transform: translateZ(0);
  transition: transform .05s ease-in, box-shadow .05s ease-in;
  text-decoration: none;
  cursor: pointer;
}

.poster-btn:hover {
  opacity: 0.9;
}

.poster-btn:active { 
  transform: translateY(1px); 
  box-shadow: 0 1px 0 #00000030; 
}

/* Make hero section CTA borders visually thinner */
#hero .poster-btn {
  /* use a smaller fraction of the global stroke for hero CTAs */
  border-width: calc(var(--stroke) * 0.45);
}

/* Make dealers page buttons match hero section styling */
#dealers .poster-btn,
#contact .poster-btn,
#demo .poster-btn {
  border-width: calc(var(--stroke) * 0.45);
}

/* Hero button animation styles */
#hero-buttons {
  min-height: calc(var(--ru) * 2.4); /* Ensure consistent height during animation */
}

#hero #get-access-btn {
  transition: transform 0.7s ease-in-out !important;
  position: relative;
}

#hero #get-access-btn.sliding {
  transition: transform 0.7s ease-in-out !important;
}

#hero #get-access-btn:not(.sliding):not(.resetting) {
  transition: transform 0.05s ease-in, box-shadow 0.05s ease-in !important;
}

#hero #get-access-btn.resetting {
  transition: transform 1s ease-in-out !important;
}

#hero #get-access-btn:not(.sliding):hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#hero #get-access-btn.sliding {
  transform: translateX(calc(200% + calc(var(--ru) * 1.6))) !important; /* Move to watch demo button position */
  z-index: 10;
}

#hero #get-access-btn.sliding:hover {
  background: var(--blue) !important;
  opacity: 1 !important;
  transform: translateX(calc(200% + calc(var(--ru) * 1.6))) !important;
}

#hero-buttons.animating #dealership-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-out;
}

#hero-buttons.animating #watch-demo-btn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s ease-out;
}

/* Ensure smooth transitions for all buttons */
#dealership-btn, #watch-demo-btn {
  transition: opacity 0.5s ease-in-out;
}

#hero-email-form {
  transform: translateY(10px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

#hero-email-form.visible {
  opacity: 1 !important;
  pointer-events: all !important;
  transform: translateY(0);
}

/* Email input styling to match button height */
#email-input {
  height: calc(var(--ru) * 1.2 + calc(var(--ru) * .6) * 2); /* Match button height */
  border: 1px solid var(--silver);
  transition: border-color 0.2s ease;
}

#email-input:focus {
  border-color: var(--navy);
  outline: none;
}

/* Ensure proper layout during animation */
#hero-buttons.animating #get-access-btn {
  position: relative;
  z-index: 10;
}

/* Email message styling */
#email-error {
  padding: calc(var(--ru) * 0.4) calc(var(--ru) * 0.8);
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  color: white;
  position: absolute;
  white-space: nowrap;
  z-index: 20;
  top: 100%;
  margin-top: calc(var(--ru) * 0.5);
  left: calc(var(--ru) * 1.2);
}

/* Error state */
#email-error.error {
  background-color: #dc2626;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2);
}

/* Success state */
#email-error.success {
  background-color: #16a34a;
  box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2);
}

/* Waitlist message styling */
#waitlist-message {
  padding: calc(var(--ru) * 0.4) calc(var(--ru) * 0.8) !important;
  border-radius: 8px !important;
  font-size: 0.875rem !important;
  font-weight: 500 !important;
  color: white !important;
  white-space: nowrap !important;
  margin-top: calc(var(--ru) * 0.5) !important;
  text-align: center !important;
}

/* Waitlist error state */
#waitlist-message.error {
  background-color: #dc2626 !important;
  box-shadow: 0 2px 4px rgba(220, 38, 38, 0.2) !important;
}

/* Waitlist success state */
#waitlist-message.success {
  background-color: #16a34a !important;
  box-shadow: 0 2px 4px rgba(22, 163, 74, 0.2) !important;
}

/* Shake animation for waitlist button */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.shake {
  animation: shake 0.6s ease-in-out;
  animation-iteration-count: 1;
}

/* Pulse animation as alternative */
@keyframes pulse-attention {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(10, 36, 99, 0.4); }
  50% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(10, 36, 99, 0); }
}

.pulse-attention {
  animation: pulse-attention 1.5s infinite;
}

/* Prevent layout shift during animation */
#hero-buttons.animating {
  pointer-events: none;
}

#hero-buttons.animating #get-access-btn {
  pointer-events: all;
}

/* Layout Utilities */
.canvas-pad { 
  padding: calc(var(--ru)*1.5); 
}

.stack > * + * { 
  margin-top: calc(var(--ru)*.9); 
}

/* Typography */
.headline {
  font-weight: 900;
  letter-spacing: -0.01em; 
  line-height: .94;        
  text-wrap: balance;
}

.subhead { 
  line-height: 1.08; 
  letter-spacing: -0.005em; 
}

.display-xl { 
  font-size: clamp(40px, 9.8vw, 132px); 
}

.display-md { 
  font-size: clamp(22px, 2.8vw, 40px); 
}

.label { 
  font-size: clamp(12px, 1.1vw, 16px); 
  text-transform: none; 
}

/* Utility Classes */
.truncate-soft { 
  overflow: hidden; 
  text-overflow: ellipsis; 
  white-space: nowrap; 
}

/* Scrollbar Hiding */
* {
  -ms-overflow-style: none !important;
  scrollbar-width: none !important;
}

*::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Responsive Design Enhancements */
@media (max-width: 640px) {
  .canvas-pad {
    padding: calc(var(--ru)*1);
  }
  
  .poster-btn {
    padding: calc(var(--ru)*.5) calc(var(--ru)*1);
    font-size: 14px;
  }
  
  .headline {
    line-height: 1;
  }
}

@media (max-width: 480px) {
  :root {
    --ru: clamp(14px, 5vw, 28px);
  }
  
  .canvas-pad {
    padding: calc(var(--ru)*.8);
  }
}

/* Animation Classes */
.fade-in {
  opacity: 0;
  animation: fadeIn 0.6s ease-in forwards;
}

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

.slide-up {
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp 0.6s ease-out forwards;
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}

/* Car Scroll Animations */
.car-scroll {
  transition: transform 0.1s ease-out;
  will-change: transform;
}

.car-scroll.moving-right {
  animation: none;
}

.car-scroll.moving-left {
  animation: none;
}

/* ========================================
   Modal Loading Animation
   ======================================== */

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}