/* Global Styles - WCAG 2.2 Compliant */
/* Function Health inspired design with Lawn Master brand colors */

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

:root {
  /* Primary - Lawn Master Brand Green */
  --color-primary: #4D6B2F;
  --color-primary-dark: #3A5223;
  --color-primary-light: #5B8C22;

  /* Emphasis - For italic serif text */
  --color-emphasis: #4D6B2F;

  /* Neutrals - Function Health warm tones */
  --color-text: #1A1A1A;
  --color-text-light: #4A5568;
  --color-text-muted: #6B7280;
  --color-bg: #FAFBF9;
  --color-bg-cream: #F5F7F2;
  --color-bg-light: #EDF2E9;
  --color-border: #E2E8E0;

  /* Commercial Section - Professional Navy */
  --color-commercial: #1E3A5F;
  --color-commercial-light: #2D4A6F;

  /* Status Colors */
  --color-success: #22C55E;
  --color-warning: #F59E0B;
  --color-error: #EF4444;
  --color-info: #3B82F6;

  /* Dark Section (footer, CTAs) */
  --color-dark-bg: #1A1F16;
  --color-dark-text: #FAFBF9;

  /* Accent Colors */
  --color-accent: #7cb342;           /* Lime accent for dark sections */
  --color-accent-dark: #5d8a2f;      /* Darker variant */
  --color-star: #facc15;             /* Star/rating yellow */
  --color-verified: #3B82F6;         /* Verified badge blue (matches info) */

  /* Urgency/Alert Colors (for CTAs, limited-time offers) */
  --color-urgency: #dc2626;          /* Red for urgency messaging */
  --color-urgency-light: #fca5a5;    /* Light urgency for dark backgrounds */
  --color-urgency-bg: rgba(239, 68, 68, 0.1);
  --color-urgency-border: rgba(239, 68, 68, 0.3);

  /* Overlay Utilities (for layering on backgrounds) */
  --overlay-light-subtle: rgba(255, 255, 255, 0.1);
  --overlay-light-medium: rgba(255, 255, 255, 0.3);
  --overlay-light-strong: rgba(255, 255, 255, 0.7);
  --overlay-dark-subtle: rgba(0, 0, 0, 0.1);
  --overlay-dark-medium: rgba(0, 0, 0, 0.3);

  /* Glass/Frosted Effects */
  --color-bg-glass: rgba(250, 251, 249, 0.95);
  --color-bg-glass-dark: rgba(26, 31, 22, 0.95);

  /* Gradient Base Colors (for Hero/dark sections) */
  --gradient-dark-start: #1a2614;
  --gradient-dark-mid: #2a3d22;
  --gradient-dark-end: #1e2b18;

  /* Typography */
  --font-sans: "DM Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --font-mono: "SF Mono", Monaco, "Cascadia Code", monospace;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;
  --spacing-4xl: 6rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(26, 26, 26, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(26, 26, 26, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(26, 26, 26, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(26, 26, 26, 0.1);

  /* Layout */
  --max-width: 1200px;
  --max-width-content: 800px;
  --header-height: 80px;

  /* 
   * Breakpoints (documented for reference - use exact values in media queries)
   * CSS custom properties cannot be used in media queries, so use these values directly:
   * - Mobile-first: base styles (no media query)
   * - Tablet: @media (min-width: 768px)
   * - Desktop: @media (min-width: 1024px)
   * 
   * For max-width queries (rare, prefer min-width):
   * - Mobile only: @media (max-width: 767px)
   * - Tablet and below: @media (max-width: 1023px)
   */
}

/* Note: Google Fonts are loaded via <link> in Layout.astro for better performance */

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + var(--spacing-lg));
}

body {
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 400;
  line-height: 1.2;
  color: var(--color-text);
  margin-top: 0;
  margin-bottom: 1rem;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.01em;
}

h3 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 500;
}

h4 {
  font-size: 1.25rem;
  font-weight: 600;
}

h5, h6 {
  font-size: 1.125rem;
  font-weight: 600;
}

/* Serif emphasis for headlines - Function Health pattern */
.serif {
  font-family: var(--font-serif);
}

.serif-italic {
  font-family: var(--font-serif);
  font-style: italic;
}

/* Headline pattern: "Regular text" + "italic serif" */
h1 em, h2 em, h3 em {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  color: var(--color-primary);
}

p {
  margin-bottom: 1rem;
}

.lead {
  font-size: 1.25rem;
  line-height: 1.7;
  color: var(--color-text-light);
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color 0.2s, outline 0.2s;
}

a:hover {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

a:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Lists */
ul, ol {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

li {
  margin-bottom: 0.5rem;
}

/* Checkmark list */
.check-list {
  list-style: none;
  padding-left: 0;
}

.check-list li {
  position: relative;
  padding-left: 2rem;
  margin-bottom: 0.75rem;
}

.check-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.25rem;
  width: 1.25rem;
  height: 1.25rem;
  background: var(--color-success);
  border-radius: var(--radius-full);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'/%3E%3C/svg%3E");
  background-size: 14px;
  background-position: center;
  background-repeat: no-repeat;
}

/* Buttons - Pill shaped like Function Health */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
  min-width: 44px;
  padding: 0.875rem 1.75rem;
  font-size: 1rem;
  gap: 0.5rem;
}

.btn:focus {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--color-primary);
  color: white;
}

.btn-primary:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--color-primary-dark);
  color: white;
  text-decoration: none;
}

.btn-secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--color-primary);
  color: white;
  text-decoration: none;
}

.btn-outline {
  background: transparent;
  color: var(--color-text);
  border-color: var(--color-border);
}

.btn-outline:hover:not(:disabled):not([aria-disabled="true"]) {
  border-color: var(--color-text);
  text-decoration: none;
}

.btn-commercial {
  background: var(--color-commercial);
  color: white;
}

.btn-commercial:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--color-commercial-light);
  color: white;
  text-decoration: none;
}

/* White outline button for dark backgrounds (WCAG 2.2 3:1 contrast) */
.btn-outline-white {
  background: transparent;
  color: white;
  border-color: var(--overlay-light-strong);
}

.btn-outline-white:hover:not(:disabled):not([aria-disabled="true"]) {
  background: var(--overlay-light-subtle);
  border-color: white;
  color: white;
  text-decoration: none;
}

.btn-outline-white:focus {
  outline-color: white;
}

.btn-sm {
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
  min-height: 36px;
}

.btn-lg {
  padding: 1rem 2.25rem;
  font-size: 1.125rem;
  min-height: 52px;
}

.btn-full {
  width: 100%;
}

/* Cards - Cream background with rounded corners */
.card {
  background: var(--color-bg-cream);
  border-radius: var(--radius-xl);
  padding: var(--spacing-xl);
  transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-white {
  background: white;
}

.card-no-hover:hover {
  transform: none;
  box-shadow: none;
}

/* Section containers */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--spacing-lg);
}

.section {
  padding: var(--spacing-4xl) 0;
}

.section-cream {
  background: var(--color-bg-light);
}

.section-dark {
  background: var(--color-dark-bg);
  color: var(--color-dark-text);
  position: relative;
}

/* Idaho/Mountain-inspired pattern for dark sections */
.section-dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    /* Subtle mountain silhouette at bottom */
    linear-gradient(
      175deg,
      transparent 0%,
      transparent 70%,
      rgba(74, 124, 89, 0.08) 70%,
      rgba(74, 124, 89, 0.05) 85%,
      transparent 85%
    ),
    /* Secondary peak */
    linear-gradient(
      168deg,
      transparent 0%,
      transparent 75%,
      rgba(74, 124, 89, 0.05) 75%,
      rgba(74, 124, 89, 0.03) 88%,
      transparent 88%
    ),
    /* Ambient glow spots */
    radial-gradient(ellipse 60% 40% at 10% 90%, rgba(91, 140, 34, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse 40% 30% at 90% 85%, rgba(74, 124, 89, 0.08) 0%, transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.section-dark > * {
  position: relative;
  z-index: 1;
}

/* Grass texture pattern background */
.section-grass-pattern {
  position: relative;
}

.section-grass-pattern::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    repeating-linear-gradient(
      85deg,
      transparent,
      transparent 3px,
      rgba(74, 124, 89, 0.02) 3px,
      rgba(74, 124, 89, 0.02) 6px
    );
  pointer-events: none;
  z-index: 0;
}

.section-grass-pattern > * {
  position: relative;
  z-index: 1;
}

.section-dark h1,
.section-dark h2,
.section-dark h3,
.section-dark h4,
.section-dark h5,
.section-dark h6 {
  color: var(--color-dark-text);
}

.section-dark em {
  color: var(--color-primary-light);
}

/* Badges/Pills */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 1rem;
  background: var(--color-primary);
  color: white;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: var(--radius-full);
}

.badge-commercial {
  background: var(--color-commercial);
}

.badge-success {
  background: var(--color-success);
}

.badge-outline {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text);
}

/* Step indicators */
.step-number {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

/* Trust bar / stats */
.trust-bar {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--spacing-xl);
}

.trust-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.trust-item::after {
  content: '';
  width: 1px;
  height: 1.5rem;
  background: currentColor;
  opacity: 0.3;
  margin-left: var(--spacing-xl);
}

.trust-item:last-child::after {
  display: none;
}

/* Price display */
.price-large {
  font-size: 3rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
}

.price-period {
  font-size: 1rem;
  font-weight: 400;
  color: var(--color-text-muted);
}

.price-compare {
  text-decoration: line-through;
  color: var(--color-text-muted);
}

/* Images */
img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus styles for keyboard navigation - WCAG 2.2 Level AA */
*:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  z-index: 10;
}

/* Enhanced focus for interactive elements */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 3px;
  box-shadow: 0 0 0 1px rgba(77, 107, 47, 0.2);
}

/* Ensure focus not obscured by sticky headers (WCAG 2.4.11) */
:target {
  scroll-margin-top: 120px;
  scroll-padding-top: 120px;
}

:target:focus-visible {
  position: relative;
  z-index: 5;
}

/* Target size minimum 24x24px for interactive elements (WCAG 2.5.8) */
button,
a,
input[type="button"],
input[type="submit"],
input[type="checkbox"],
input[type="radio"],
select {
  min-height: 24px;
  min-width: 24px;
}

/* Touch targets should be at least 44x44px for mobile */
@media (pointer: coarse) {
  button,
  a,
  input[type="button"],
  input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: white;
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 1000;
  border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
  top: 0;
}

/* Forms */
.form-group {
  margin-bottom: var(--spacing-lg);
}

label {
  display: block;
  font-weight: 500;
  margin-bottom: var(--spacing-sm);
  color: var(--color-text);
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 0.875rem 1rem;
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-text);
  background: white;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="password"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(77, 107, 47, 0.1);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--color-text-muted);
}

/* Error states */
.form-error input,
.form-error textarea,
.form-error select {
  border-color: var(--color-error);
}

.error-message {
  color: var(--color-error);
  font-size: 0.875rem;
  margin-top: var(--spacing-xs);
}

/* Utility classes */
.text-center {
  text-align: center;
}

.text-left {
  text-align: left;
}

.text-right {
  text-align: right;
}

.text-primary {
  color: var(--color-primary);
}

.text-muted {
  color: var(--color-text-muted);
}

.text-light {
  color: var(--color-text-light);
}

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--spacing-sm); }
.mb-2 { margin-bottom: var(--spacing-md); }
.mb-3 { margin-bottom: var(--spacing-lg); }
.mb-4 { margin-bottom: var(--spacing-xl); }
.mb-5 { margin-bottom: var(--spacing-2xl); }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--spacing-sm); }
.mt-2 { margin-top: var(--spacing-md); }
.mt-3 { margin-top: var(--spacing-lg); }
.mt-4 { margin-top: var(--spacing-xl); }
.mt-5 { margin-top: var(--spacing-2xl); }

/* Grid utilities */
.grid {
  display: grid;
  gap: var(--spacing-lg);
}

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

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

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

@media (max-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Flex utilities */
.flex {
  display: flex;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.flex-wrap {
  flex-wrap: wrap;
}

.gap-1 { gap: var(--spacing-sm); }
.gap-2 { gap: var(--spacing-md); }
.gap-3 { gap: var(--spacing-lg); }
.gap-4 { gap: var(--spacing-xl); }

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  @page {
    margin: 2cm;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000000;
    --color-text: #000000;
    --color-bg: #ffffff;
  }
}

/* Reduced motion support */
@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;
  }
}

