/* =====================================
   GD CONSTRUCTION INC — BLACK/RED/GRAY SYSTEM
   Strict color palette: #111111, #C40000, #737373, #E5E5E5, #F7F7F7
   ===================================== */

/* === COLOR TOKENS === */
:root {
  --black: #111111;
  --red: #C40000;
  --red-hover: #990000;
  --red-light: #FCA5A5;
  --gray-50: #F7F7F7;
  --gray-100: #EFEFEF;
  --gray-200: #E5E5E5;
  --gray-500: #737373;
  --gray-800: #1F1F1F;
  --white: #FFFFFF;
}

/* === GLOBAL STYLES === */
html {
  scroll-behavior: smooth;
}

body {
  color: var(--black);
}

/* Screen reader only utility with focus support */
.sr-only-focusable {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: fixed;
  top: 1rem;
  left: 1rem;
  width: auto;
  height: auto;
  padding: 0.75rem 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background-color: var(--white);
  color: var(--black);
  border-radius: 0.5rem;
  border: 2px solid var(--red);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 9999;
  font-weight: 600;
}

/* === TYPOGRAPHY === */
h1, h2, h3, h4, h5, h6 {
  color: var(--black);
}

p {
  color: var(--black);
}

/* === HERO SECTION STYLES === */
/* Force white text on hero headline with text shadow for readability */
.hero-section h1,
section.text-white h1,
#main > section:first-child h1 {
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.hero-section p,
section.text-white p {
  color: #ffffff !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* === NAV LINKS === */
.nav-link {
  color: var(--white);
}

.nav-link:hover {
  color: var(--red);
}

.nav-link:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

/* === RED LINKS === */
.link-red {
  color: var(--red);
  text-decoration: none;
}

.link-red:hover {
  color: var(--red-hover);
  text-decoration: underline;
}

.link-red:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* === BUTTONS === */
.cta-button,
.cta-button-primary {
  background-color: var(--red);
  color: var(--white);
}

.cta-button:hover,
.cta-button-primary:hover {
  background-color: var(--red-hover);
}

.cta-button:focus-visible,
.cta-button-primary:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
  box-shadow: 0 0 0 4px var(--red-light);
}

.secondary-button {
  background-color: var(--white);
  color: var(--black);
  border: 1px solid var(--gray-200);
}

.secondary-button:hover {
  background-color: var(--gray-50);
}

.secondary-button-outline {
  background-color: transparent;
  color: var(--black);
  border: 1px solid var(--gray-200);
}

.secondary-button-outline:hover {
  background-color: var(--gray-50);
  border-color: var(--gray-500);
}

.secondary-button:focus-visible,
.secondary-button-outline:focus-visible {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

/* === ANIMATIONS === */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Animation classes */
.fade-in {
  animation: fadeIn 0.8s ease-out;
}

.fade-in-up {
  animation: fadeInUp 0.8s ease-out;
  animation-fill-mode: both;
}

.slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

/* Stagger animation delays */
.fade-in-up:nth-child(1) { animation-delay: 0.1s; }
.fade-in-up:nth-child(2) { animation-delay: 0.2s; }
.fade-in-up:nth-child(3) { animation-delay: 0.3s; }
.fade-in-up:nth-child(4) { animation-delay: 0.4s; }
.fade-in-up:nth-child(5) { animation-delay: 0.5s; }
.fade-in-up:nth-child(6) { animation-delay: 0.6s; }

/* === HEADER STYLES === */
#header {
  background-color: var(--black);
  border-bottom: 1px solid var(--gray-800);
}

#header.scrolled {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* === FORM STYLES === */
.form-input,
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="file"],
textarea,
select {
  border: 1px solid var(--gray-200);
  transition: all 0.2s ease;
  color: var(--black);
  background-color: var(--white);
}

.form-input:focus,
input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-light);
}

input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
  border-color: var(--red);
}

input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown) {
  border-color: var(--gray-500);
}

/* File input styling */
input[type="file"] {
  color: var(--gray-500);
}

input[type="file"]::file-selector-button {
  background-color: var(--red);
  color: var(--white);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 600;
  cursor: pointer;
  margin-right: 1rem;
  transition: background-color 0.2s ease;
}

input[type="file"]::file-selector-button:hover {
  background-color: var(--red-hover);
}

/* Form message styles */
.form-success {
  padding: 0.75rem 1rem;
  background-color: var(--gray-50);
  color: var(--black);
  border: 1px solid var(--gray-200);
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

.form-error {
  padding: 0.75rem 1rem;
  background-color: var(--gray-50);
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 0.5rem;
  font-size: 0.875rem;
}

/* === FOOTER STYLES === */
.footer-link {
  color: var(--gray-100);
}

.footer-link:hover {
  color: var(--white);
}

.footer-link:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.footer-social {
  color: var(--gray-100);
  transition: color 0.2s ease;
}

.footer-social:hover {
  color: var(--red);
}

.footer-social:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* === IMAGE HOVER EFFECTS === */
img {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* === SCROLL REVEAL === */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* === LOADING SPINNER === */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

/* === MOBILE MENU === */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

#mobile-menu:not(.hidden) {
  max-height: 500px;
}

.mobile-nav-link {
  color: var(--white);
}

.mobile-nav-link:hover {
  color: var(--red);
}

/* === RESPONSIVE IMPROVEMENTS === */
@media (max-width: 640px) {
  /* Improve touch targets on mobile */
  button,
  a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Better spacing on mobile */
  section {
    scroll-margin-top: 4rem;
  }
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
  button,
  a {
    border: 2px solid currentColor;
  }
  
  .cta-button,
  .cta-button-primary {
    border: 2px solid var(--white);
  }
}

/* === FOCUS VISIBLE STYLES === */
:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

/* === CUSTOM SCROLLBAR === */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--gray-50);
}

::-webkit-scrollbar-thumb {
  background: var(--gray-500);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--black);
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-500) var(--gray-50);
}

/* === PRINT STYLES === */
@media print {
  header,
  footer,
  #mobile-menu,
  button,
  a[href^="#"] {
    display: none !important;
  }
  
  body {
    background: white;
    color: black;
  }
  
  a[href]:after {
    content: " (" attr(href) ")";
  }
  
  .cta-button,
  .cta-button-primary {
    background-color: var(--black) !important;
    color: white !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* === UTILITY CLASSES === */
.text-balance {
  text-wrap: balance;
}

.text-pretty {
  text-wrap: pretty;
}

/* === BORDERS & SHADOWS === */
.border-gray {
  border-color: var(--gray-200);
}

.shadow-soft {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.shadow-soft:hover {
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.10);
}

/* === CONTRAST COMPLIANCE === */
/* Ensure all text meets WCAG AA standards */
.text-black {
  color: var(--black); /* 21:1 on white */
}

.text-gray {
  color: var(--gray-500); /* 4.6:1 on white - AA compliant */
}

.text-red {
  color: var(--red); /* 7.9:1 on white - AAA compliant */
}

/* Background + text combinations */
.bg-black {
  background-color: var(--black);
  color: var(--white);
}

.bg-gray-dark {
  background-color: var(--gray-800);
  color: var(--white);
}

.bg-gray-light {
  background-color: var(--gray-50);
  color: var(--black);
}

.bg-white {
  background-color: var(--white);
  color: var(--black);
}
