/* Responsive & Accessibility Enhancements */

/* ===================
   RESPONSIVE BREAKPOINTS
   Mobile First Approach
   - xs: 0-479px (default)
   - sm: 480-639px
   - md: 640-767px
   - lg: 768-1023px
   - xl: 1024-1279px
   - 2xl: 1280px+
   =================== */

/* Extra small devices (phones, 479px and down) */
@media (max-width: 479px) {
  .hero__title {
    font-size: var(--font-size-2xl);
  }

  .hero__cta {
    flex-direction: column;
  }

  .hero__cta .btn {
    width: 100%;
    justify-content: center;
  }

  .section-header__title {
    font-size: var(--font-size-xl);
  }

  .cta-section h2 {
    font-size: var(--font-size-xl);
  }

  .process-note blockquote {
    font-size: var(--font-size-lg);
  }

  .contact-card {
    flex-direction: column;
    text-align: center;
  }

  .contact-card__avatar {
    margin-inline: auto;
  }

  .stat-card__number,
  .stat-item__number {
    font-size: var(--font-size-3xl);
  }

  .showcase__differentiator {
    flex-direction: column;
    text-align: center;
  }

  .showcase__diff-icon {
    margin-inline: auto;
  }
}

/* Small devices (large phones, 480px to 639px) */
@media (min-width: 480px) and (max-width: 639px) {
  .hero__title {
    font-size: var(--font-size-3xl);
  }
}

/* Medium devices (tablets, 640px to 767px) */
@media (min-width: 640px) and (max-width: 767px) {
  .container {
    padding-inline: var(--space-6);
  }
}

/* Large devices (small laptops, 768px to 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .hero__grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hero__content {
    max-width: 100%;
  }

  .hero__tags {
    justify-content: center;
  }

  .hero__cta {
    justify-content: center;
  }

  .hero-mockup {
    max-width: 500px;
  }
}

/* Extra large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
  .container {
    padding-inline: var(--space-10);
  }
}

/* ===================
   PRINT STYLES
   =================== */
@media print {
  .nav,
  .footer,
  .cta-section,
  .nav__toggle,
  .btn {
    display: none !important;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
  }

  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
    color: #000;
  }

  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  .section {
    padding: 1rem 0;
  }

  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
}

/* ===================
   ACCESSIBILITY
   =================== */

/* Reduced motion for users who prefer it */
@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;
  }

  .hero-mockup__float {
    animation: none;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --color-primary-600: #0056b3;
    --color-secondary-600: #007f5f;
    --color-neutral-600: #333;
  }

  .btn--primary {
    border: 2px solid currentColor;
  }

  .card--border {
    border-width: 2px;
  }
}

/* Focus styles for keyboard navigation */
:focus-visible {
  outline: 3px solid var(--color-primary-500);
  outline-offset: 3px;
}

/* Remove default focus outline if custom one is applied */
:focus:not(:focus-visible) {
  outline: none;
}

/* Better focus visibility for interactive elements */
.btn:focus-visible,
.nav__link:focus-visible,
.form__input:focus-visible,
.form__select:focus-visible,
.form__textarea:focus-visible {
  outline: 3px solid var(--color-primary-500);
  outline-offset: 2px;
}

/* Ensure sufficient color contrast for links */
a {
  text-decoration-skip-ink: auto;
}

/* Screen reader only utility */
.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;
}

/* Make sure interactive elements are large enough for touch */
@media (pointer: coarse) {
  .btn {
    min-height: 48px;
    min-width: 48px;
  }

  .nav__link {
    padding: var(--space-3) var(--space-2);
  }

  .form__input,
  .form__select,
  .form__textarea {
    min-height: 48px;
  }
}

/* ===================
   DARK MODE (Future Ready)
   =================== */
@media (prefers-color-scheme: dark) {
  /*
   * Placeholder for dark mode styles
   * Can be enabled by adding class="dark-mode" to :root
   */
  :root.dark-mode {
    --color-bg-primary: var(--color-neutral-900);
    --color-bg-secondary: var(--color-neutral-800);
    --color-text-primary: var(--color-neutral-50);
    --color-text-secondary: var(--color-neutral-200);
  }
}

/* ===================
   COMPONENT-SPECIFIC RESPONSIVE FIXES
   =================== */

/* Navigation responsive fixes */
@media (max-width: 1023px) {
  .nav__container {
    padding-block: var(--space-3);
  }

  .nav__logo-img {
    height: 42px;
  }
}

/* Hero section responsive fixes */
@media (max-width: 767px) {
  .hero {
    padding-top: calc(70px + var(--space-10));
  }

  .hero-mockup__float {
    display: none;
  }
}

/* Card grid responsive fixes */
@media (max-width: 639px) {
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* Process section responsive */
@media (max-width: 767px) {
  .process::before {
    display: none;
  }

  .process__step {
    padding-left: var(--space-12);
    text-align: left;
    position: relative;
  }

  .process__number {
    position: absolute;
    left: 0;
    top: 0;
    margin: 0;
  }
}

/* Footer responsive */
@media (max-width: 767px) {
  .footer__grid {
    text-align: center;
  }

  .footer__brand {
    margin-inline: auto;
  }

  .footer__logo {
    justify-content: center;
  }

  .footer__bottom {
    text-align: center;
  }

  .footer__social {
    justify-content: center;
  }
}

/* Blog card responsive */
@media (max-width: 479px) {
  .blog-card__content {
    padding: var(--space-4);
  }
}

/* Form responsive */
@media (max-width: 639px) {
  .form__row {
    grid-template-columns: 1fr;
  }
}

/* Contact section responsive */
@media (max-width: 1023px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .contact-form-wrapper {
    order: -1;
  }
}

/* Product section responsive */
@media (max-width: 1023px) {
  .product-grid--reversed {
    direction: ltr;
  }
}

/* Stats section responsive */
@media (max-width: 479px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ===================
   LOADING STATES
   =================== */
.spinner {
  animation: spin 1s linear infinite;
}

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

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--color-neutral-200) 25%, var(--color-neutral-100) 50%, var(--color-neutral-200) 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===================
   FORM VALIDATION STATES
   =================== */
.form__input.input--error,
.form__select.input--error,
.form__textarea.input--error {
  border-color: var(--color-error);
}

.form__input.input--error:focus,
.form__select.input--error:focus,
.form__textarea.input--error:focus {
  box-shadow: 0 0 0 3px rgba(229, 57, 53, 0.2);
}

.form__input.input--valid,
.form__select.input--valid,
.form__textarea.input--valid {
  border-color: var(--color-success);
}

.form__input.input--valid:focus,
.form__select.input--valid:focus,
.form__textarea.input--valid:focus {
  box-shadow: 0 0 0 3px rgba(38, 201, 153, 0.2);
}
