/* Pasture & Plate CSS Foundation */
/* Modern, clean, natural, trustworthy design for ethical chicken farm */

/* 1. CSS Custom Properties (Variables) */
:root {
  /* Colors - Earthy palette reflecting Spanish landscape */
  --color-primary-green: #4A7C59; /* Earthy green for growth and nature */
  --color-secondary-terracotta: #E27D60; /* Terracotta for authenticity */
  --color-accent-yellow: #D4A574; /* Muted yellow for warmth */
  --color-background-light: #F8F9FA; /* Warm off-white for purity */
  --color-background-dark: #2C3E50; /* Dark for contrast */
  --color-text-dark: #2C3E50; /* Primary text */
  --color-text-light: #FFFFFF; /* Light text */
  --color-border: #E9ECEF; /* Subtle borders */
  --color-shadow: rgba(0, 0, 0, 0.1); /* Soft shadows */

  /* Typography */
  --font-family-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; /* Clean sans-serif */
  --font-family-accent: 'Playfair Display', Georgia, serif; /* Subtle serif for accents */
  --font-size-h1: clamp(2.5rem, 5vw, 3.5rem);
  --font-size-h2: clamp(2rem, 4vw, 2.5rem);
  --font-size-h3: clamp(1.75rem, 3.5vw, 2rem);
  --font-size-h4: clamp(1.5rem, 3vw, 1.75rem);
  --font-size-h5: clamp(1.25rem, 2.5vw, 1.5rem);
  --font-size-h6: clamp(1.125rem, 2vw, 1.25rem);
  --font-size-body: 1rem;
  --font-size-small: 0.875rem;
  --line-height-body: 1.6;
  --line-height-heading: 1.2;

  /* Spacing Scale */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;
  --spacing-3xl: 4rem;

  /* Borders and Shadows */
  --border-radius: 0.5rem;
  --border-radius-lg: 0.75rem;
  --box-shadow: 0 0.125rem 0.25rem var(--color-shadow);
  --box-shadow-lg: 0 0.5rem 1rem var(--color-shadow);

  /* Transitions */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.3s ease-in-out;
}

/* Dark mode support (optional, for future) */
/* Removed auto dark mode - conflicts with manual bg-dark/bg-light sections */
/* @media (prefers-color-scheme: dark) {
  :root {
    --color-background-light: #1a1a1a;
    --color-text-dark: #FFFFFF;
  }
} */

/* 2. CSS Reset/Normalize */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-family-primary);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  color: var(--color-text-dark);
  background-color: var(--color-background-light);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
  font-family: var(--font-family-primary);
  font-weight: 600;
  line-height: var(--line-height-heading);
}

p {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
}

a {
  color: var(--color-primary-green);
  text-decoration: none;
}

a:hover {
  color: var(--color-secondary-terracotta);
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

ul, ol {
  margin-top: 0;
  margin-bottom: var(--spacing-md);
  padding-left: var(--spacing-lg);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* 3. Typography System */
h1 { font-size: var(--font-size-h1); }
h2 { font-size: var(--font-size-h2); }
h3 { font-size: var(--font-size-h3); }
h4 { font-size: var(--font-size-h4); }
h5 { font-size: var(--font-size-h5); }
h6 { font-size: var(--font-size-h6); }

.lead {
  font-size: 1.25rem;
  font-weight: 300;
}

.text-accent {
  font-family: var(--font-family-accent);
  font-style: italic;
}

.text-center { text-align: center; }
.text-muted { color: #6C757D !important; }

/* Link styles with accessibility */
a:focus {
  outline: 2px solid var(--color-primary-green);
  outline-offset: 2px;
}

/* 4. Layout Utilities */
/* Container - Complements Bootstrap */
.pl-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Custom grid utilities (avoid conflict with Bootstrap .row) */
.pl-grid {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.pl-grid > * {
  flex: 1;
}

@media (min-width: 768px) {
  .pl-grid-cols-2 > * { flex-basis: calc(50% - var(--spacing-md)/2); }
  .pl-grid-cols-3 > * { flex-basis: calc(33.333% - var(--spacing-md)/2 * 2/3); }
}

/* Flex utilities */
.pl-flex { display: flex; }
.pl-flex-center { display: flex; justify-content: center; align-items: center; }
.pl-flex-between { display: flex; justify-content: space-between; align-items: center; }

/* Spacing utilities */
.pl-mt-sm { margin-top: var(--spacing-sm); }
.pl-mb-lg { margin-bottom: var(--spacing-lg); }
.pl-p-md { padding: var(--spacing-md); }

/* 5. Components */

/* Navigation - CRITICAL: Light navbar with dark text */
.navbar {
  background-color: var(--color-background-light) !important;
  border-bottom: 1px solid var(--color-border);
}

.navbar-brand {
  font-family: var(--font-family-accent);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary-green) !important;
}

.nav-link {
  color: var(--color-text-dark) !important;
  transition: color var(--transition-normal);
}

.nav-link:hover,
.nav-link:focus {
  color: var(--color-secondary-terracotta) !important;
}

.navbar-toggler {
  border: 1px solid var(--color-primary-green);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(2, 117, 95, 1)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Mobile nav toggle */
@media (max-width: 991.98px) {
  .navbar-collapse {
    background-color: var(--color-background-light);
    border-top: 1px solid var(--color-border);
    margin-top: var(--spacing-sm);
  }
}

/* Buttons - Reusable, complements Bootstrap */
.btn-primary-custom {
  background-color: var(--color-primary-green);
  border-color: var(--color-primary-green);
  color: var(--color-text-light);
  border-radius: var(--border-radius);
  transition: all var(--transition-normal);
  font-weight: 500;
}

.btn-primary-custom:hover,
.btn-primary-custom:focus {
  background-color: #3a6548;
  border-color: #3a6548;
  color: var(--color-text-light);
  transform: translateY(-1px);
  box-shadow: var(--box-shadow-lg);
}

.btn-secondary-custom {
  background-color: transparent;
  border: 2px solid var(--color-secondary-terracotta);
  color: var(--color-secondary-terracotta);
  border-radius: var(--border-radius);
  transition: all var(--transition-normal);
}

.btn-secondary-custom:hover,
.btn-secondary-custom:focus {
  background-color: var(--color-secondary-terracotta);
  color: var(--color-text-light);
  transform: translateY(-1px);
}

/* Cards - Prevent squishing in Bootstrap grid */
.row[class*='g-'] > [class*='col-']:has([class*='card']) {
  display: flex !important;
  flex-direction: column !important;
}

[class*='card'] {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  border: none;
  border-radius: var(--border-radius-lg);
  box-shadow: var(--box-shadow);
  transition: all var(--transition-normal);
  overflow: hidden;
  background-color: #ffffff;
}

/* Override for dark sections - cards stay white */
.bg-dark .card,
section.bg-dark .card,
.bg-dark .card.h-100,
section.bg-dark .card.h-100 {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: var(--color-text-light) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

/* Override for light sections - cards are dark */
.bg-light .card,
section.bg-light .card {
  background-color: var(--color-background-dark) !important;
}

/* Override Bootstrap card variables in light sections - Make cards dark */
.bg-light .card,
section.bg-light .card,
.bg-light section .card,
section.bg-light section .card {
  --bs-card-bg: var(--color-background-dark) !important;
  --bs-card-color: var(--color-text-light) !important;
  --bs-body-color: var(--color-text-light) !important;
  background-color: var(--color-background-dark) !important;
  color: var(--color-text-light) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* SPECIFIC: Cards inside sections with bg-light class */
section.bg-light .card,
section.bg-light .card.h-100 {
  background-color: var(--color-background-dark) !important;
  color: var(--color-text-light) !important;
}

section.bg-light .card .card-body,
section.bg-light .card .card-body.d-flex,
section.bg-light .card .card-body.flex-column {
  background-color: var(--color-background-dark) !important;
  color: var(--color-text-light) !important;
}

section.bg-light .card .card-body h3.card-title,
section.bg-light .card .card-body .card-title {
  color: var(--color-text-light) !important;
}

section.bg-light .card .card-body p.card-text,
section.bg-light .card .card-body .card-text,
section.bg-light .card .card-body p.card-text.flex-grow-1 {
  color: var(--color-text-light) !important;
}

/* Force all children to inherit light color except buttons and images - SIMPLIFIED */
.bg-light .card .card-body,
.bg-light .card .card-body h1,
.bg-light .card .card-body h2,
.bg-light .card .card-body h3,
.bg-light .card .card-body h4,
.bg-light .card .card-body h5,
.bg-light .card .card-body h6,
.bg-light .card .card-body p,
.bg-light .card .card-body .card-title,
.bg-light .card .card-body .card-text,
section.bg-light .card .card-body,
section.bg-light .card .card-body h1,
section.bg-light .card .card-body h2,
section.bg-light .card .card-body h3,
section.bg-light .card .card-body h4,
section.bg-light .card .card-body h5,
section.bg-light .card .card-body h6,
section.bg-light .card .card-body p,
section.bg-light .card .card-body .card-title,
section.bg-light .card .card-body .card-text {
  color: var(--color-text-light) !important;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: var(--box-shadow-lg);
}

.card-img-top {
  height: 200px;
  object-fit: cover;
}

/* Specific fixes for h-100 cards */
.card.h-100,
.gamelift-card.h-100,
[class*='-card'].h-100 {
  min-height: 500px !important;
}

.card.h-100 > *,
.gamelift-card.h-100 > *:not(img):not(.btn) {
  flex-grow: 1;
}

.card.h-100 img,
.gamelift-card.h-100 img,
[class*='-card'].h-100 img {
  height: 280px !important;
  min-height: 280px !important;
  max-height: 280px !important;
  object-fit: cover !important;
}

.card-body {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  padding: var(--spacing-lg);
}

/* Override Bootstrap card-body variables in light sections */
.bg-light .card-body,
.bg-light .card .card-body,
section.bg-light .card-body,
section.bg-light .card .card-body {
  --bs-card-color: var(--color-text-light) !important;
  color: var(--color-text-light) !important;
  background-color: var(--color-background-dark) !important;
}

/* Cards in dark sections should be light with dark text */
.bg-dark .card,
section.bg-dark .card {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: var(--color-text-light) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.bg-dark .card .card-body,
section.bg-dark .card .card-body {
  background-color: transparent !important;
  color: var(--color-text-light) !important;
}

/* Override text-light class for cards in dark sections - keep them LIGHT */
.bg-dark.text-light .card,
section.bg-dark.text-light .card,
.bg-dark.text-light .card *:not(.btn):not(button),
section.bg-dark.text-light .card *:not(.btn):not(button) {
  color: var(--color-text-light) !important;
}

.bg-dark.text-light .card .card-body,
section.bg-dark.text-light .card .card-body,
.bg-dark.text-light .card .card-body *:not(.btn):not(button),
section.bg-dark.text-light .card .card-body *:not(.btn):not(button) {
  color: var(--color-text-light) !important;
}

/* SIMPLE: Force WHITE text for all card content in dark sections */
section.bg-dark .card,
section.bg-dark .card *:not(.btn):not(button),
section.bg-dark .card .card-body,
section.bg-dark .card .card-body *:not(.btn):not(button) {
  color: var(--color-text-light) !important;
}

section.bg-dark .card .card-title,
section.bg-dark .card .card-text,
section.bg-dark .card h1,
section.bg-dark .card h2,
section.bg-dark .card h3,
section.bg-dark .card h4,
section.bg-dark .card h5,
section.bg-dark .card h6,
section.bg-dark .card p {
  color: var(--color-text-light) !important;
}

.bg-dark .card .card-title,
.bg-dark .card .card-text,
.bg-dark .card-body h1,
.bg-dark .card-body h2,
.bg-dark .card-body h3,
.bg-dark .card-body h4,
.bg-dark .card-body h5,
.bg-dark .card-body h6,
.bg-dark .card-body p,
.bg-dark .card-body .card-title,
.bg-dark .card-body h3.card-title,
section.bg-dark .card .card-title,
section.bg-dark .card .card-text,
section.bg-dark .card-body h1,
section.bg-dark .card-body h2,
section.bg-dark .card-body h3,
section.bg-dark .card-body h4,
section.bg-dark .card-body h5,
section.bg-dark .card-body h6,
section.bg-dark .card-body p,
section.bg-dark .card-body .card-title,
section.bg-dark .card-body h3.card-title {
  color: var(--color-text-light) !important;
}

.card-title {
  font-size: var(--font-size-h4);
  margin-bottom: var(--spacing-sm);
  color: var(--color-text-dark);
}

/* Override card-title in light sections */
.bg-light .card-title,
.bg-light .card .card-title,
.bg-light .card-body .card-title,
section.bg-light .card-title,
section.bg-light .card .card-title,
section.bg-light .card-body .card-title {
  color: var(--color-text-light) !important;
}

.card-text {
  flex-grow: 1;
}

/* Override card-text in light sections */
.bg-light .card-text,
.bg-light .card .card-text,
.bg-light .card-body .card-text,
section.bg-light .card-text,
section.bg-light .card .card-text,
section.bg-light .card-body .card-text {
  color: var(--color-text-light) !important;
}

/* Forms */
.form-control-custom {
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  padding: var(--spacing-md);
  transition: border-color var(--transition-fast);
}

.form-control-custom:focus {
  border-color: var(--color-primary-green);
  box-shadow: 0 0 0 0.2rem rgba(74, 124, 89, 0.25);
  outline: none;
}

.form-label {
  font-weight: 500;
  color: var(--color-text-dark);
}

/* Hero Section */
.hero {
  background: linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4)), url('../images/spanish-pasture-sunrise.jpg') center/cover;
  color: var(--color-text-light);
  padding: var(--spacing-3xl) 0;
  text-align: center;
}

.hero h1 {
  font-size: clamp(3rem, 6vw, 4rem);
  font-family: var(--font-family-accent);
  margin-bottom: var(--spacing-lg);
  color: var(--color-text-light);
}

.hero p {
  font-size: 1.25rem;
  max-width: 600px;
  margin: 0 auto var(--spacing-xl);
  color: var(--color-text-light);
}

/* Light sections - Ensure dark text on light background */
.bg-light,
section.bg-light {
  background-color: var(--color-background-light) !important;
  color: var(--color-text-dark) !important;
}

.bg-light h1,
.bg-light h2,
.bg-light h3,
.bg-light h4,
.bg-light h5,
.bg-light h6,
section.bg-light h1,
section.bg-light h2,
section.bg-light h3,
section.bg-light h4,
section.bg-light h5,
section.bg-light h6 {
  color: var(--color-text-dark) !important;
}

.bg-light p,
.bg-light .lead,
section.bg-light p,
section.bg-light .lead {
  color: var(--color-text-dark) !important;
}

/* Cards in light sections are excluded from dark text - they have dark background */
/* This rule is handled by specific card rules above */

.bg-light .card-body,
section.bg-light .card-body,
.bg-light section .card-body,
section.bg-light section .card-body {
  color: var(--color-text-light) !important;
  background-color: var(--color-background-dark) !important;
}

/* All text in dark cards should be light - STRONG SPECIFICITY */
.bg-light .card h1,
.bg-light .card h2,
.bg-light .card h3,
.bg-light .card h4,
.bg-light .card h5,
.bg-light .card h6,
.bg-light .card .card-title,
.bg-light .card-body h1,
.bg-light .card-body h2,
.bg-light .card-body h3,
.bg-light .card-body h4,
.bg-light .card-body h5,
.bg-light .card-body h6,
.bg-light .card-body .card-title,
.bg-light .card-body h3.card-title,
section.bg-light .card h1,
section.bg-light .card h2,
section.bg-light .card h3,
section.bg-light .card h4,
section.bg-light .card h5,
section.bg-light .card h6,
section.bg-light .card .card-title,
section.bg-light .card-body h1,
section.bg-light .card-body h2,
section.bg-light .card-body h3,
section.bg-light .card-body h4,
section.bg-light .card-body h5,
section.bg-light .card-body h6,
section.bg-light .card-body .card-title,
section.bg-light .card-body h3.card-title {
  color: var(--color-text-light) !important;
}

.bg-light .card p,
.bg-light .card .card-text,
.bg-light .card .lead,
.bg-light .card-body p,
.bg-light .card-body .card-text,
.bg-light .card-body .lead,
.bg-light .card-body p.card-text,
.bg-light .card-body p.card-text.flex-grow-1,
section.bg-light .card p,
section.bg-light .card .card-text,
section.bg-light .card .lead,
section.bg-light .card-body p,
section.bg-light .card-body .card-text,
section.bg-light .card-body .lead,
section.bg-light .card-body p.card-text,
section.bg-light .card-body p.card-text.flex-grow-1 {
  color: var(--color-text-light) !important;
}

/* Apply light color to all card content except buttons and images - SIMPLIFIED */
.bg-light .card-body,
.bg-light .card-body h1,
.bg-light .card-body h2,
.bg-light .card-body h3,
.bg-light .card-body h4,
.bg-light .card-body h5,
.bg-light .card-body h6,
.bg-light .card-body p,
.bg-light .card-body .card-title,
.bg-light .card-body .card-text,
.bg-light .card-body .lead,
.bg-light .card-body div,
.bg-light .card-body span,
section.bg-light .card-body,
section.bg-light .card-body h1,
section.bg-light .card-body h2,
section.bg-light .card-body h3,
section.bg-light .card-body h4,
section.bg-light .card-body h5,
section.bg-light .card-body h6,
section.bg-light .card-body p,
section.bg-light .card-body .card-title,
section.bg-light .card-body .card-text,
section.bg-light .card-body .lead,
section.bg-light .card-body div,
section.bg-light .card-body span {
  color: var(--color-text-light) !important;
}

/* Ensure buttons keep their original colors */
.bg-light .card .btn-primary-custom,
.bg-light .card .btn-secondary-custom,
.bg-light .card button.btn,
.bg-light .card a.btn,
section.bg-light .card .btn-primary-custom,
section.bg-light .card .btn-secondary-custom,
section.bg-light .card button.btn,
section.bg-light .card a.btn {
  color: inherit !important;
}

.bg-light .card img,
section.bg-light .card img {
  opacity: 1 !important;
}

.bg-light .card a:not(.btn-primary-custom):not(.btn-secondary-custom):not(.btn),
section.bg-light .card a:not(.btn-primary-custom):not(.btn-secondary-custom):not(.btn) {
  color: var(--color-accent-yellow) !important;
}

.bg-light .card a:not(.btn-primary-custom):not(.btn-secondary-custom):not(.btn):hover,
section.bg-light .card a:not(.btn-primary-custom):not(.btn-secondary-custom):not(.btn):hover {
  color: var(--color-text-light) !important;
}

.bg-light a:not(.btn-primary-custom):not(.btn-secondary-custom),
section.bg-light a:not(.btn-primary-custom):not(.btn-secondary-custom) {
  color: var(--color-primary-green) !important;
}

.bg-light .testimonial-card,
.bg-light .testimonial-text,
.bg-light .testimonial-author,
section.bg-light .testimonial-card,
section.bg-light .testimonial-text,
section.bg-light .testimonial-author {
  color: var(--color-text-dark) !important;
}

.bg-light .text-muted,
section.bg-light .text-muted {
  color: #6C757D !important;
}

/* Ensure no white text on light backgrounds */
.bg-light .text-white,
.bg-light .text-light,
section.bg-light .text-white,
section.bg-light .text-light {
  color: var(--color-text-dark) !important;
}

/* Additional elements in light sections */
.bg-light .list-group-item,
section.bg-light .list-group-item {
  color: var(--color-text-dark) !important;
  background-color: #fff !important;
}

.bg-light .form-control,
.bg-light .form-select,
.bg-light input,
.bg-light select,
.bg-light textarea,
section.bg-light .form-control,
section.bg-light .form-select,
section.bg-light input,
section.bg-light select,
section.bg-light textarea {
  color: var(--color-text-dark) !important;
  background-color: #fff !important;
}

.bg-light .accordion-item,
.bg-light .accordion-header,
.bg-light .accordion-body,
section.bg-light .accordion-item,
section.bg-light .accordion-header,
section.bg-light .accordion-body {
  color: var(--color-text-dark) !important;
}

.bg-light .accordion-button:not(.collapsed),
section.bg-light .accordion-button:not(.collapsed) {
  color: var(--color-text-dark) !important;
  background-color: #fff !important;
}

/* Footer */
footer {
  background-color: var(--color-background-dark);
  color: var(--color-text-light);
  padding: var(--spacing-xl) 0;
  margin-top: var(--spacing-2xl);
}

.footer-link {
  color: var(--color-text-light);
  transition: color var(--transition-normal);
}

.footer-link:hover {
  color: var(--color-accent-yellow);
}

/* Testimonials Carousel */
.testimonial-card {
  background: var(--color-background-light);
  border-radius: var(--border-radius-lg);
  padding: var(--spacing-lg);
  text-align: center;
  box-shadow: var(--box-shadow);
}

.testimonial-text {
  font-style: italic;
  margin-bottom: var(--spacing-md);
}

.testimonial-author {
  font-weight: 500;
  color: var(--color-primary-green);
}

/* 6. Responsive Breakpoints - Mobile-first */
@media (min-width: 576px) {
  .pl-container { padding: 0 var(--spacing-lg); }
}

@media (min-width: 768px) {
  .hero { padding: var(--spacing-3xl) 0 var(--spacing-2xl); }
}

@media (min-width: 992px) {
  .pl-grid-cols-3 > * { flex-basis: calc(33.333% - var(--spacing-md)/3); }
}

@media (min-width: 1200px) {
  .pl-container { max-width: 1140px; }
}

/* 7. Micro-interactions */
* {
  transition: all var(--transition-normal);
}

.btn-custom:focus,
.card:focus,
.nav-link:focus {
  outline: 2px solid var(--color-primary-green);
  outline-offset: 2px;
}

/* AOS overrides for theme - Moved to prevent conflicts */
body.aos-ready [data-aos] {
  transition-duration: 0.8s;
  transition-property: opacity, transform, visibility;
}

/* Fancybox overrides */
.fancybox__container {
  --fancybox-accent-color: var(--color-primary-green);
}

/* Swiper overrides */
.swiper {
  --swiper-theme-color: var(--color-primary-green);
}

/* Lazyload placeholders - Only apply to images, not content */
img.lazyload,
img.lazyloading {
  opacity: 0.5;
  transition: opacity var(--transition-normal);
}

img.lazyloaded {
  opacity: 1;
}

/* Ensure AOS elements are visible even if AOS fails to load */
/* AOS library adds opacity: 0 by default, so we ensure visibility */
[data-aos] {
  visibility: visible !important;
}

/* Initially visible until AOS takes over */
body:not(.aos-ready) [data-aos] {
  opacity: 1 !important;
}

/* AOS will override these styles when initialized */
body.aos-ready [data-aos]:not(.aos-animate) {
  opacity: 0;
}

body.aos-ready [data-aos].aos-animate {
  opacity: 1;
}

/* Accessibility: Ensure contrast and focus */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-text-dark: #000000;
    --color-background-light: #FFFFFF;
  }
}

/* Print styles */
@media print {
  .navbar, footer { display: none; }
  .card { box-shadow: none; }
}

/* 404 Page Specific Enhancements */
.error-hero {
  position: relative;
  animation: subtle-wander 2s ease-in-out infinite alternate;
}

@keyframes subtle-wander {
  0% { transform: translateX(0); }
  100% { transform: translateX(10px); }
}

#search-input:focus {
  border-color: var(--color-primary-green);
  box-shadow: 0 0 0 0.2rem rgba(74, 124, 89, 0.25);
}

.confused-chicken-img:hover {
  transform: scale(1.05);
  transition: transform 0.3s ease;
}

/* FINAL OVERRIDE: Ensure cards in light sections have dark background and light text */
/* This rule must be at the end to override any Bootstrap styles */
section.bg-light .card,
.bg-light .card,
section.bg-light .card .card-body,
.bg-light .card .card-body {
  background-color: var(--color-background-dark) !important;
  color: var(--color-text-light) !important;
}

section.bg-light .card .card-body *,
.bg-light .card .card-body *,
section.bg-light .card h1,
section.bg-light .card h2,
section.bg-light .card h3,
section.bg-light .card h4,
section.bg-light .card h5,
section.bg-light .card h6,
section.bg-light .card p,
section.bg-light .card .card-title,
section.bg-light .card .card-text,
.bg-light .card h1,
.bg-light .card h2,
.bg-light .card h3,
.bg-light .card h4,
.bg-light .card h5,
.bg-light .card h6,
.bg-light .card p,
.bg-light .card .card-title,
.bg-light .card .card-text {
  color: var(--color-text-light) !important;
}

/* Exclude buttons from the above rule */
section.bg-light .card .btn-primary-custom,
section.bg-light .card .btn-secondary-custom,
section.bg-light .card button,
section.bg-light .card a.btn,
.bg-light .card .btn-primary-custom,
.bg-light .card .btn-secondary-custom,
.bg-light .card button,
.bg-light .card a.btn {
  color: inherit !important;
}

/* ABSOLUTE FINAL OVERRIDE - Highest specificity for card-body content */
section#breeds.bg-light .card .card-body,
section#breeds.bg-light .card .card-body *,
.bg-light section .card .card-body,
.bg-light section .card .card-body * {
  color: var(--color-text-light) !important;
}

/* But exclude buttons, images, and links styled as buttons */
section#breeds.bg-light .card .card-body button,
section#breeds.bg-light .card .card-body .btn,
.bg-light section .card .card-body button,
.bg-light section .card .card-body .btn,
section#breeds.bg-light .card .card-body img,
.bg-light section .card .card-body img {
  color: inherit !important;
}

/* FINAL OVERRIDE for dark sections with text-light */
section.bg-dark.text-light .card,
section.bg-dark.text-light .card .card-body,
section.bg-dark.text-light .card .card-body h1,
section.bg-dark.text-light .card .card-body h2,
section.bg-dark.text-light .card .card-body h3,
section.bg-dark.text-light .card .card-body h4,
section.bg-dark.text-light .card .card-body h5,
section.bg-dark.text-light .card .card-body h6,
section.bg-dark.text-light .card .card-body p,
section.bg-dark.text-light .card .card-title,
section.bg-dark.text-light .card .card-text,
.bg-dark.text-light .card,
.bg-dark.text-light .card .card-body,
.bg-dark.text-light .card .card-body h1,
.bg-dark.text-light .card .card-body h2,
.bg-dark.text-light .card .card-body h3,
.bg-dark.text-light .card .card-body h4,
.bg-dark.text-light .card .card-body h5,
.bg-dark.text-light .card .card-body h6,
.bg-dark.text-light .card .card-body p,
.bg-dark.text-light .card .card-title,
.bg-dark.text-light .card .card-text {
  color: var(--color-text-dark) !important;
}

/* ULTIMATE OVERRIDE: Dark sections = dark semi-transparent cards with white text */
section.bg-dark .card,
section.bg-dark .card.h-100,
section.bg-dark div.card,
.bg-dark .card,
.bg-dark .card.h-100,
.bg-dark div.card {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #FFFFFF !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
}

section.bg-dark .card *,
section.bg-dark .card h1,
section.bg-dark .card h2,
section.bg-dark .card h3,
section.bg-dark .card h4,
section.bg-dark .card h5,
section.bg-dark .card h6,
section.bg-dark .card p,
section.bg-dark .card .card-title,
section.bg-dark .card .card-text,
section.bg-dark .card-body,
section.bg-dark .card-body *,
section.bg-dark .card-body h1,
section.bg-dark .card-body h2,
section.bg-dark .card-body h3,
section.bg-dark .card-body h4,
section.bg-dark .card-body h5,
section.bg-dark .card-body h6,
section.bg-dark .card-body p,
section.bg-dark .card-body .card-title,
section.bg-dark .card-body .card-text,
.bg-dark .card *,
.bg-dark .card h1,
.bg-dark .card h2,
.bg-dark .card h3,
.bg-dark .card h4,
.bg-dark .card h5,
.bg-dark .card h6,
.bg-dark .card p,
.bg-dark .card .card-title,
.bg-dark .card .card-text,
.bg-dark .card-body,
.bg-dark .card-body *,
.bg-dark .card-body h1,
.bg-dark .card-body h2,
.bg-dark .card-body h3,
.bg-dark .card-body h4,
.bg-dark .card-body h5,
.bg-dark .card-body h6,
.bg-dark .card-body p,
.bg-dark .card-body .card-title,
.bg-dark .card-body .card-text {
  color: #FFFFFF !important;
}

/* Keep buttons with their original colors */
section.bg-dark .card button,
section.bg-dark .card .btn,
.bg-dark .card button,
.bg-dark .card .btn {
  color: var(--color-text-light) !important;
}

/* Custom Breed Box - Simple, no Bootstrap conflicts */
.breed-box {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.breed-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.2);
}

.breed-img {
  width: 100%;
  height: auto;
  object-fit: cover;
  display: block;
}

.breed-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  background-color: #ffffff;
}

.breed-content h3 {
  font-size: var(--font-size-h4);
  margin-bottom: 1rem;
  color: #2C3E50 !important;
  font-weight: 600;
}

.breed-content p {
  flex-grow: 1;
  margin-bottom: 1rem;
  color: #2C3E50 !important;
  line-height: 1.6;
}

.breed-content .btn {
  align-self: flex-start;
}

/* Custom Commitment Box - For value propositions with icons */
.commitment-box {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #ffffff;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: center;
  padding: 2rem 1.5rem;
}

.commitment-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 0.75rem 1.5rem rgba(0, 0, 0, 0.15);
}

.commitment-icon {
  width: 80px;
  height: 80px;
  margin: 0 auto 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-primary-green), var(--color-accent-yellow));
  border-radius: 50%;
  color: #ffffff;
  font-size: 2rem;
}

.commitment-content h5 {
  font-size: var(--font-size-h5);
  margin-bottom: 1rem;
  color: #2C3E50 !important;
  font-weight: 600;
}

.commitment-content p {
  margin-bottom: 1.5rem;
  color: #2C3E50 !important;
  line-height: 1.6;
}

.commitment-content .btn {
  display: inline-block;
}

/* Custom Flock Friend Box - For personalized chicken profiles */
.flock-friend-box {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: #ffffff;
  border-radius: var(--border-radius-lg);
  overflow: hidden;
  box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  text-align: center;
}

.flock-friend-box:hover {
  transform: translateY(-5px);
  box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.2);
}

.flock-friend-img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
}

.flock-friend-content {
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  background-color: #ffffff;
}

.flock-friend-content h4 {
  font-size: var(--font-size-h4);
  margin-bottom: 1rem;
  color: #2C3E50 !important;
  font-weight: 600;
}

.flock-friend-content p {
  margin-bottom: 0;
  color: #2C3E50 !important;
  line-height: 1.6;
  text-align: left;
}