/**
 * SURPRISE GRANITE - Mobile-First Landing Page
 * Consolidated mobile styles - REPLACES scattered mobile CSS
 * Version: 1.0
 *
 * MOBILE-FIRST: Base styles are for mobile, media queries add desktop styles
 */

/* ===== CSS VARIABLES ===== */
:root {
  --sg-gold: #f9cb00;
  --sg-gold-dark: #e5b800;
  --sg-dark: #1a1a2e;
  --sg-darker: #0f0f1a;
  --sg-text: #ffffff;
  --sg-text-muted: rgba(255,255,255,0.7);
  --sg-border: rgba(255,255,255,0.1);

  /* Safe areas for notched phones */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  /* Spacing */
  --spacing-xs: 8px;
  --spacing-sm: 12px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;

  /* Animation */
  --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== GLOBAL MOBILE FIXES ===== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Inter', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  /* Dark background visible behind hero card */
  background: var(--sg-darker, #0f0f1a);
}

/* Prevent horizontal scroll */
.page-wrapper,
.main-wrapper,
main {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Touch optimization */
a, button, input, select, textarea, [role="button"] {
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(249, 203, 0, 0.2);
}

/* Minimum touch targets */
button, .button, .w-button,
input[type="submit"], input[type="button"],
a.button, [role="button"] {
  min-height: 44px;
}

/* Prevent iOS zoom on inputs */
input[type="text"], input[type="email"], input[type="tel"],
input[type="number"], input[type="password"], input[type="search"],
select, textarea {
  font-size: 16px !important;
}

/* ===== MOBILE HERO - SCROLL EXPANSION EFFECT ===== */
/* Hero starts as a card, expands to fullscreen on scroll */

.sg-hero {
  position: relative;
  min-height: 85vh;
  min-height: 85dvh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding-bottom: var(--spacing-xl);
  overflow: hidden;

  /* Card-like initial state */
  margin: 12px;
  border-radius: 24px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.3);

  /* Smooth expansion transition */
  transition:
    margin 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    border-radius 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    box-shadow 0.4s ease,
    min-height 0.4s ease;
}

/* Expanded state - fullscreen immersive */
.sg-hero--expanded {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Background clips to border-radius */
.sg-hero__bg {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  z-index: 0;
}

.sg-hero__video {
  position: absolute;
  top: 50%;
  left: 50%;
  min-width: 100%;
  min-height: 100%;
  transform: translate(-50%, -50%);
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
  border-radius: inherit;
}

.sg-hero__video--active {
  opacity: 1;
}

.sg-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  border-radius: inherit;
}

.sg-hero__gradient {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    180deg,
    rgba(10,10,15,0.3) 0%,
    rgba(10,10,15,0.4) 40%,
    rgba(10,10,15,0.85) 85%,
    rgba(10,10,15,0.95) 100%
  );
}

/* Content - Mobile First */
.sg-hero__content {
  position: relative;
  z-index: 10;
  width: 100%;
  padding: var(--spacing-md);
  padding-top: calc(60px + var(--safe-top));
  padding-bottom: calc(var(--spacing-xl) + var(--safe-bottom));
}

/* Scene transitions */
.sg-hero__scenes {
  position: relative;
  min-height: auto;
}

.sg-hero__scene {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  position: absolute;
  width: 100%;
}

.sg-hero__scene.active {
  opacity: 1;
  transform: translateY(0);
  position: relative;
}

/* Headlines - Mobile optimized */
.sg-hero__headline-simple {
  font-size: 2rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 var(--spacing-xs) 0;
  letter-spacing: -0.02em;
  line-height: 1.1;
  text-shadow: 0 2px 20px rgba(0,0,0,0.5);
}

.sg-hero__sub-simple {
  font-size: 0.95rem;
  color: var(--sg-text-muted);
  margin: 0 0 var(--spacing-lg) 0;
  font-weight: 400;
  line-height: 1.4;
}

/* CTA Button - Mobile */
.sg-hero__cta-simple {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  width: 100%;
  max-width: 320px;
  padding: var(--spacing-md) var(--spacing-lg);
  background: linear-gradient(135deg, var(--sg-gold) 0%, var(--sg-gold-dark) 100%);
  color: var(--sg-dark);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
  box-shadow: 0 4px 20px rgba(249,203,0,0.3);
}

.sg-hero__cta-simple:active {
  transform: scale(0.98);
}

/* Trust badge for mobile */
.sg-hero__trust-mobile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
  font-size: 0.8rem;
  color: var(--sg-text-muted);
}

.sg-hero__trust-mobile svg {
  width: 16px;
  height: 16px;
  color: var(--sg-gold);
}

/* Phone link for mobile */
.sg-hero__phone-mobile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--sg-border);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.sg-hero__phone-mobile svg {
  width: 18px;
  height: 18px;
  color: var(--sg-gold);
}

/* Hide desktop-only elements on mobile */
.sg-hero__audience,
.sg-hero__stats,
.sg-hero__scroll,
.sg-hero__noise,
.sg-hero__headlines,
.sg-hero__seo-heading {
  display: none;
}

/* Show mobile-only elements */
.sg-hero__trust-mobile,
.sg-hero__phone-mobile {
  display: flex;
}

/* ===== SECTION SPACING - Mobile ===== */
section, .section {
  padding: var(--spacing-2xl) var(--spacing-md);
  scroll-margin-top: 60px;
}

.section-header {
  margin-bottom: var(--spacing-lg);
  text-align: center;
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: var(--spacing-xs);
  color: var(--sg-dark);
}

.section-header p {
  font-size: 0.95rem;
  color: #666;
  max-width: 500px;
  margin: 0 auto;
}

/* ===== NAVIGATION - Mobile ===== */
.unified-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  padding: var(--spacing-sm) var(--spacing-md);
  padding-top: calc(var(--spacing-sm) + var(--safe-top));
  background: rgba(15,15,26,0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--sg-border);
  transition: transform 0.3s var(--ease-out);
}

.unified-nav.hidden {
  transform: translateY(-100%);
}

.unified-nav__container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1400px;
  margin: 0 auto;
}

.unified-nav__logo img {
  height: 28px;
  width: auto;
}

.unified-nav__actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

/* Mobile menu button */
.unified-nav__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: transparent;
  border: none;
  color: #fff;
  cursor: pointer;
}

.unified-nav__menu-btn svg {
  width: 24px;
  height: 24px;
}

/* Desktop nav - hidden on mobile */
.unified-nav__links {
  display: none;
}

/* ===== MOBILE MENU OVERLAY ===== */
.sg-mobile-menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: linear-gradient(180deg, var(--sg-darker) 0%, var(--sg-dark) 100%);
  display: none;
  flex-direction: column;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.sg-mobile-menu-overlay.open {
  display: flex;
}

.sg-mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md);
  padding-top: calc(var(--spacing-md) + var(--safe-top));
  border-bottom: 1px solid var(--sg-border);
  position: sticky;
  top: 0;
  background: rgba(15,15,26,0.98);
  backdrop-filter: blur(20px);
  z-index: 1;
}

.sg-mobile-menu-close {
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: 50%;
  color: rgba(255,255,255,0.8);
  cursor: pointer;
}

.sg-mobile-menu-nav {
  flex: 1;
  padding: var(--spacing-md);
}

.sg-mobile-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-sm);
  width: 100%;
  padding: var(--spacing-md);
  background: linear-gradient(135deg, var(--sg-gold) 0%, var(--sg-gold-dark) 100%);
  color: var(--sg-dark) !important;
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 12px;
  margin-bottom: var(--spacing-md);
  box-shadow: 0 4px 20px rgba(249,203,0,0.25);
}

.sg-mobile-menu-nav a:not(.sg-mobile-cta) {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 10px;
  min-height: 48px;
  transition: background 0.2s ease;
}

.sg-mobile-menu-nav a:not(.sg-mobile-cta):active {
  background: rgba(255,255,255,0.08);
}

.sg-mobile-menu-footer {
  padding: var(--spacing-md);
  padding-bottom: calc(var(--spacing-md) + var(--safe-bottom));
  border-top: 1px solid var(--sg-border);
  background: rgba(0,0,0,0.2);
}

/* ===== CARDS & GRIDS - Mobile ===== */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-md);
}

.card {
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.card-image {
  aspect-ratio: 16/10;
  object-fit: cover;
  width: 100%;
}

.card-content {
  padding: var(--spacing-md);
}

.card-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--spacing-xs);
  color: var(--sg-dark);
}

.card-desc {
  font-size: 0.875rem;
  color: #666;
  line-height: 1.5;
}

/* ===== BUTTONS - Mobile ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  min-height: 48px;
  padding: var(--spacing-sm) var(--spacing-lg);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--sg-gold) 0%, var(--sg-gold-dark) 100%);
  color: var(--sg-dark);
  box-shadow: 0 4px 16px rgba(249,203,0,0.25);
}

.btn-secondary {
  background: var(--sg-dark);
  color: #fff;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--sg-dark);
  color: var(--sg-dark);
}

.btn-full {
  width: 100%;
}

/* ===== FORMS - Mobile ===== */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #333;
  margin-bottom: var(--spacing-xs);
}

.form-input {
  width: 100%;
  min-height: 48px;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: var(--sg-gold);
  box-shadow: 0 0 0 3px rgba(249,203,0,0.15);
}

/* ===== FLOATING WIDGETS - Mobile ===== */
.sg-widget, #sgWidget {
  position: fixed !important;
  bottom: 16px !important;
  left: 16px !important;
  right: auto !important;
  z-index: 9999 !important;
  max-width: 50px !important;
}

#sg-chat-widget,
#chatbase-bubble-button,
[id*="chatbase"] {
  position: fixed !important;
  bottom: 16px !important;
  right: 16px !important;
  left: auto !important;
  z-index: 2147483647 !important;
}

/* ===== SCROLL PERFORMANCE ===== */
.scroll-container {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Horizontal scroll carousels */
.swiper, .swiper-container,
.horizontal-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.swiper::-webkit-scrollbar,
.horizontal-scroll::-webkit-scrollbar {
  display: none;
}

.swiper-slide, .scroll-item {
  scroll-snap-align: start;
  flex-shrink: 0;
}

/* ===== FOOTER - Mobile ===== */
.footer {
  padding: var(--spacing-2xl) var(--spacing-md);
  padding-bottom: calc(var(--spacing-2xl) + var(--safe-bottom));
  background: var(--sg-dark);
  color: #fff;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--spacing-lg);
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.footer-link {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.9rem;
  padding: var(--spacing-xs) 0;
  min-height: 44px;
  display: flex;
  align-items: center;
}

.footer-link:active {
  color: var(--sg-gold);
}

/* ===== 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;
  }
}

/* Focus states */
:focus-visible {
  outline: 3px solid var(--sg-gold);
  outline-offset: 2px;
}

:focus:not(:focus-visible) {
  outline: none;
}

/* =========================================
   TABLET & DESKTOP BREAKPOINTS
   ========================================= */

/* Tablet: 768px+ */
@media (min-width: 768px) {
  :root {
    --spacing-md: 20px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    --spacing-2xl: 64px;
  }

  /* Hero adjustments */
  .sg-hero {
    min-height: 90vh;
    justify-content: center;
  }

  .sg-hero__content {
    padding: var(--spacing-xl);
    text-align: center;
  }

  .sg-hero__headline-simple {
    font-size: 3rem;
  }

  .sg-hero__sub-simple {
    font-size: 1.1rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
  }

  .sg-hero__cta-simple {
    width: auto;
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.1rem;
  }

  /* Card grids */
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-lg);
  }

  /* Section headers */
  .section-header h2 {
    font-size: 2rem;
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Desktop: 1024px+ */
@media (min-width: 1024px) {
  /* Show desktop nav, hide mobile menu button */
  .unified-nav__links {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
  }

  .unified-nav__menu-btn {
    display: none;
  }

  /* Hide mobile-only hero elements on desktop */
  .sg-hero__trust-mobile,
  .sg-hero__phone-mobile {
    display: none;
  }

  /* Hero */
  .sg-hero {
    min-height: 100vh;
  }

  .sg-hero__content {
    padding: var(--spacing-2xl);
  }

  .sg-hero__headline-simple {
    font-size: 4rem;
  }

  .sg-hero__sub-simple {
    font-size: 1.25rem;
    max-width: 600px;
  }

  .sg-hero__cta-simple:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 32px rgba(249,203,0,0.4);
  }

  /* Show desktop elements */
  .sg-hero__audience,
  .sg-hero__stats,
  .sg-hero__scroll {
    display: flex;
  }

  /* Cards */
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Footer */
  .footer-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Widgets */
  .sg-widget, #sgWidget {
    max-width: 280px !important;
  }
}

/* Large Desktop: 1440px+ */
@media (min-width: 1440px) {
  .sg-hero__headline-simple {
    font-size: 5rem;
  }

  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ===== PRELOADER - Simplified ===== */
.cloud-preloader {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, var(--sg-dark) 0%, var(--sg-darker) 100%);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.cloud-preloader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ===== WEBFLOW OVERRIDES ===== */
/* Hide empty CMS elements */
.w-dyn-bind-empty,
img[src=""],
img:not([src]) {
  display: none !important;
}

/* Fix Webflow navigation conflicts */
.w-nav-overlay {
  display: none !important;
}

.w-nav-button {
  display: none !important;
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .sg-hero {
    transition: none;
  }

  .sg-hero__video {
    transition: none;
  }

  .sg-hero__scene {
    transition: none;
  }
}
