/* ============================================================
   NOUVO AYITI — Mobile-First Refinements
   Typography, contrast, and spacing optimizations
   ============================================================ */

/* ================================================================
   TYPOGRAPHY REFINEMENTS
   ================================================================ */

/* Better line height on mobile for readability */
body {
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Improve heading hierarchy */
h1 {
  font-size: clamp(1.75rem, 8vw, 3rem);
  letter-spacing: -0.02em;
  font-weight: 700;
  line-height: 1.15;
}

h2 {
  font-size: clamp(1.5rem, 6vw, 2rem);
  letter-spacing: -0.01em;
  font-weight: 700;
  line-height: 1.25;
  margin: var(--sp-8) 0 var(--sp-4);
}

h3 {
  font-size: clamp(1.25rem, 5vw, 1.5rem);
  font-weight: 600;
  line-height: 1.35;
  margin: var(--sp-6) 0 var(--sp-3);
}

h4, h5, h6 {
  font-weight: 600;
  line-height: 1.4;
  margin: var(--sp-5) 0 var(--sp-2);
}

/* Better paragraph spacing */
p {
  margin: 0 0 var(--sp-4) 0;
  line-height: 1.7;
}

p:last-child {
  margin-bottom: 0;
}

/* Code blocks readability */
code {
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 0.9em;
  color: var(--color-primary);
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

pre {
  background: var(--gray-900);
  color: var(--gray-100);
  padding: var(--sp-4);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--sp-4) 0;
}

/* ================================================================
   CONTRAST & ACCESSIBILITY
   ================================================================ */

/* Ensure minimum color contrast ratios (WCAG AA) */
.text-muted {
  color: var(--gray-600);
  /* Contrast: 6.8:1 against white background */
}

.text-subtle {
  color: var(--gray-500);
  /* Contrast: 5.2:1 against white background */
  /* Only for secondary information */
}

/* Ensure button text has sufficient contrast */
.btn {
  color: var(--color-white);
  font-weight: 600;
  /* Contrast against backgrounds: 4.5:1+ WCAG AA */
}

.btn-outline {
  color: var(--color-primary);
  font-weight: 600;
  /* Contrast: 5.2:1 against white */
}

/* Link visibility */
a {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: all 250ms ease;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* Improve visited link visibility */
a:visited {
  color: #ffffff;
}

/* ================================================================
   SPACING REFINEMENTS
   ================================================================ */

/* Tighter spacing on mobile, better on desktop */
.container {
  padding-inline: var(--sp-4);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--sp-6);
  }
}

/* Better form spacing */
.form-group {
  margin-bottom: var(--sp-5);
}

.form-group:last-child {
  margin-bottom: 0;
}

/* Improve section vertical spacing */
.section {
  padding: var(--sp-8) 0;
}

.section-sm {
  padding: var(--sp-6) 0;
}

.section-lg {
  padding: var(--sp-12) 0;
}

@media (max-width: 768px) {
  .section { padding: var(--sp-6) 0; }
  .section-lg { padding: var(--sp-8) 0; }
}

/* Card spacing inside */
.card-body {
  padding: clamp(var(--sp-4), 5vw, var(--sp-6));
}

/* Hero section spacing */
.hero {
  padding: clamp(var(--sp-6), 10vh, var(--sp-12)) 0;
}

/* ================================================================
   MOBILE-SPECIFIC REFINEMENTS
   ================================================================ */

/* Better touch targets on mobile */
@media (max-width: 768px) {
  /* Minimum 44x44px touch target */
  .btn,
  button,
  a[class*="btn"],
  input[type="button"],
  input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
    padding: max(var(--sp-3), (44px - 1em) / 2) var(--sp-4);
  }

  /* Better form input height on mobile */
  .form-input,
  .form-select,
  .form-textarea {
    min-height: 44px;
    padding: max(var(--sp-3), (44px - 1em) / 2) var(--sp-4);
    font-size: 16px; /* Prevents iOS zoom on input focus */
  }

  /* Better label visibility */
  .form-label {
    font-size: var(--text-body);
    font-weight: 600;
    margin-bottom: var(--sp-2);
  }

  /* Vertical form layout on mobile */
  .form-row {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
  }

  /* Better checkbox/radio on mobile */
  .form-check input[type="checkbox"],
  .form-check input[type="radio"] {
    width: 20px;
    height: 20px;
  }
}

/* ================================================================
   INTERACTIVE ELEMENT REFINEMENTS
   ================================================================ */

/* Better button text spacing */
.btn {
  letter-spacing: 0.5px;
}

/* Larger active/focus area for links */
a {
  padding: 2px 0; /* Invisible padding for better tap area */
}

/* Better focus indicator size */
:focus-visible {
  outline-width: 3px;
  outline-offset: 3px;
}

/* ================================================================
   IMAGE REFINEMENTS
   ================================================================ */

/* Better image rendering */
img {
  display: block;
  max-width: 100%;
  height: auto;
  image-rendering: -webkit-optimize-contrast;
}

/* Image in containers */
.img-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.img-contain {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

/* Lazy-load placeholder */
img[loading="lazy"] {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: imagePlaceholder 2s infinite;
}

img[loading="lazy"].loaded {
  animation: none;
  background: none;
}

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

/* ================================================================
   VISUAL HIERARCHY
   ================================================================ */

/* Secondary text for smaller/less important content */
.text-secondary {
  font-size: var(--text-small);
  color: var(--gray-600);
  line-height: 1.6;
}

/* Kicker/eyebrow text */
.kicker,
.eyebrow {
  display: block;
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--sp-2);
}

/* Emphasis without italic */
em {
  font-style: normal;
  color: var(--color-secondary);
  font-weight: 600;
}

/* ================================================================
   UTILITY SPACING CLASSES
   ================================================================ */

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mt-8 { margin-top: var(--sp-8); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: var(--sp-1); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.mb-8 { margin-bottom: var(--sp-8); }

.pt-0 { padding-top: 0; }
.pt-2 { padding-top: var(--sp-2); }
.pt-4 { padding-top: var(--sp-4); }
.pt-6 { padding-top: var(--sp-6); }

.pb-0 { padding-bottom: 0; }
.pb-2 { padding-bottom: var(--sp-2); }
.pb-4 { padding-bottom: var(--sp-4); }
.pb-6 { padding-bottom: var(--sp-6); }

.gap-tight { gap: var(--sp-2); }
.gap-normal { gap: var(--sp-4); }
.gap-relaxed { gap: var(--sp-6); }
.gap-spacious { gap: var(--sp-8); }

/* ================================================================
   SMALL SCREEN OPTIMIZATIONS
   ================================================================ */

@media (max-width: 480px) {
  /* Reduce heading sizes on very small screens */
  h1 {
    font-size: clamp(1.5rem, 7vw, 2.5rem);
  }

  h2 {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
  }

  h3 {
    font-size: clamp(1.125rem, 4.5vw, 1.375rem);
  }

  /* Tighter spacing on ultra-small screens */
  .section { padding: var(--sp-5) 0; }
  .section-lg { padding: var(--sp-6) 0; }

  /* Collapse card padding further */
  .card-body {
    padding: var(--sp-4);
  }

  /* Stack rows on smallest screens */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--sp-4);
  }
}

/* ================================================================
   PRINT STYLES
   ================================================================ */

@media print {
  /* Hide interactive elements */
  .burger-btn,
  .mobile-menu,
  .overlay,
  nav,
  [data-flash] {
    display: none !important;
  }

  /* Better print colors */
  a {
    color: var(--color-primary);
    text-decoration: underline;
  }

  /* Show print URLs */
  a[href]::after {
    content: " (" attr(href) ")";
  }

  /* Better page breaks */
  .section {
    page-break-inside: avoid;
  }
}
