:root {
  --brand-blue: #0050a7;
}

/* Keep all blue shades consistent across pages */
.text-blue-700,
.text-blue-600,
.text-blue-500,
.text-primary,
.text-primary-container,
.hover\:text-blue-600:hover,
.hover\:text-blue-500:hover,
.hover\:text-primary:hover {
  color: var(--brand-blue) !important;
}

.dark .dark\:hover\:text-blue-300:hover {
  color: var(--brand-blue) !important;
}

.bg-blue-700,
.bg-blue-600,
.bg-blue-500,
.bg-primary,
.bg-primary-container,
.bg-primary-dim,
.hover\:bg-blue-500:hover,
.hover\:bg-blue-800:hover,
.hover\:bg-primary:hover,
.hover\:bg-primary-dim:hover {
  background-color: var(--brand-blue) !important;
}

.border-primary {
  border-color: var(--brand-blue) !important;
}

.border-primary-container,
.border-primary-container\/30 {
  border-color: var(--brand-blue) !important;
}

.editorial-gradient {
  background: var(--brand-blue) !important;
}

/* Uniform section rhythm across all pages */
main > section {
  padding-top: 4rem !important;
  padding-bottom: 4rem !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* Common header on all pages (legacy + current templates) */
header.fixed.top-0.w-full.z-50 {
  background-color: rgba(248, 250, 252, 0.8) !important;
  border-bottom: 1px solid rgba(226, 232, 240, 0.2) !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

header.fixed.top-0.w-full.z-50 nav a {
  color: #475569 !important;
  font-weight: 500 !important;
}

header.fixed.top-0.w-full.z-50 nav a.router-link-active,
header.fixed.top-0.w-full.z-50 nav a:hover {
  color: var(--brand-blue) !important;
}

/* Keep "Book Consultation" button visually consistent */
header.fixed.top-0.w-full.z-50 > div > a.inline-block {
  background-color: var(--brand-blue) !important;
  color: #ffffff !important;
  border-radius: 0.5rem !important;
}

/* Common footer on all pages (legacy + current templates) */
footer {
  background-color: #f1f5f9 !important;
  border-top: 1px solid #e2e8f0 !important;
}

footer h5 {
  color: #0f172a !important;
}

footer p,
footer ul,
footer li,
footer a {
  color: #64748b !important;
}

footer a.router-link-active,
footer a:hover {
  color: #0f172a !important;
}
span.validation-error {
  --bs-text-opacity: 1;
  color: rgba(var(--bs-danger-rgb), var(--bs-text-opacity)) !important;
  font-size: .75rem;
  line-height: 1rem;
}

/* Mobile-first hardening across pages */
@media (max-width: 768px) {
  html,
  body {
    overflow-x: hidden;
  }

  main > section {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }

  .px-8,
  .px-12 {
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  .p-16 {
    padding: 1.5rem !important;
  }

  .p-12,
  .p-10 {
    padding: 1.25rem !important;
  }

  .text-6xl {
    font-size: 2.15rem !important;
    line-height: 1.2 !important;
  }

  .text-5xl {
    font-size: 1.85rem !important;
    line-height: 1.2 !important;
  }

  .text-4xl {
    font-size: 1.55rem !important;
    line-height: 1.25 !important;
  }

  .text-3xl {
    font-size: 1.35rem !important;
    line-height: 1.3 !important;
  }

  .flex.flex-wrap.justify-center.gap-3 > a,
  .flex.flex-wrap.justify-center.gap-3 > button {
    width: 100%;
    justify-content: center;
  }

  footer .grid {
    gap: 1.5rem !important;
  }
}

/* Tablet and small laptop improvements */
@media (max-width: 1024px) {
  .gap-24 {
    gap: 2rem !important;
  }

  .gap-16 {
    gap: 1.5rem !important;
  }

  .p-16 {
    padding: 2rem !important;
  }
}

/* Full mobile friendliness */
@media (max-width: 767px) {
  /* Header/nav: show usable navigation on mobile */
  header.fixed.top-0.w-full.z-50 > div {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 0.5rem;
  }

  header.fixed.top-0.w-full.z-50 nav.hidden.md\:flex {
    display: flex !important;
    width: 100%;
    order: 3;
    flex-wrap: wrap;
    gap: 0.25rem 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(148, 163, 184, 0.25);
  }

  header.fixed.top-0.w-full.z-50 nav.hidden.md\:flex a {
    font-size: 0.75rem !important;
    padding: 0.2rem 0;
  }

  header.fixed.top-0.w-full.z-50 > div > a.inline-block {
    order: 2;
    margin-left: auto;
    padding: 0.45rem 0.75rem !important;
    font-size: 0.75rem !important;
    line-height: 1.1;
  }

  main.pt-24,
  main.pt-28 {
    padding-top: 7.25rem !important;
  }

  /* Typographic rhythm */
  h1,
  h2,
  h3,
  h4 {
    overflow-wrap: anywhere;
  }

  p,
  li,
  a,
  span {
    overflow-wrap: anywhere;
  }

  .text-xl {
    font-size: 1.05rem !important;
    line-height: 1.5 !important;
  }

  .text-lg {
    font-size: 1rem !important;
    line-height: 1.5 !important;
  }

  /* Cards and containers */
  .rounded-3xl {
    border-radius: 1rem !important;
  }

  .rounded-\[2\.5rem\],
  .rounded-\[2rem\] {
    border-radius: 1rem !important;
  }

  .shadow-2xl,
  .shadow-xl {
    --tw-shadow: 0 8px 24px -10px rgba(0, 0, 0, 0.25) !important;
  }

  /* Keep form controls touch-friendly */
  input,
  textarea,
  button,
  a {
    max-width: 100%;
  }

  .mt-20 {
    margin-top: 2.5rem !important;
  }
}

/* Global responsive safety net for all pages/templates */
*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
  height: auto;
}

@media (max-width: 991px) {
  .max-w-7xl,
  .max-w-5xl,
  .max-w-4xl,
  .max-w-3xl,
  .max-w-2xl {
    width: 100%;
  }

  .grid {
    min-width: 0;
  }

  .flex {
    min-width: 0;
  }
}

@media (max-width: 767px) {
  /* Prevent any accidental horizontal scroll */
  .w-\[600px\],
  .w-96,
  .translate-x-32,
  .skew-x-12 {
    transform: none !important;
    width: auto !important;
    max-width: 100% !important;
  }

  /* Make all key CTA blocks stack cleanly */
  .flex.flex-wrap.gap-3 > a,
  .flex.flex-wrap.gap-3 > button,
  .flex.flex-wrap.justify-center.gap-3 > a,
  .flex.flex-wrap.justify-center.gap-3 > button {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }

  /* Keep long labels from breaking layouts */
  .font-headline,
  .font-label,
  .font-body,
  h1,
  h2,
  h3,
  h4,
  p,
  li,
  a,
  button {
    word-break: break-word;
  }

  /* Forms: full-width fields and comfortable spacing */
  form.grid {
    gap: 0.75rem !important;
  }

  input,
  textarea,
  select {
    width: 100% !important;
  }

  /* Footer readability on mobile */
  footer .grid {
    grid-template-columns: 1fr !important;
  }

  footer ul {
    padding-left: 0 !important;
  }

  /* Tighten overly large component spacing from utility classes */
  .mb-24 {
    margin-bottom: 2.5rem !important;
  }

  .mb-20 {
    margin-bottom: 2rem !important;
  }

  .py-32,
  .py-24 {
    padding-top: 2.5rem !important;
    padding-bottom: 2.5rem !important;
  }
}

/* Performance-oriented non-breaking defaults */
img[src$="logo.png"] {
  aspect-ratio: 3.5 / 1;
}

/* Reserve space for blog hero images to reduce CLS */
main img.w-full.h-auto.rounded-xl {
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

/* Keep first viewport render stable while deferring offscreen work */
@supports (content-visibility: auto) {
  main > section {
    content-visibility: auto;
    contain-intrinsic-size: 1px 900px;
  }
}
