/*
 * accessibility.css
 * Augments style.css with WCAG 2.1/2.2 compliance additions.
 * Add <link href="css/accessibility.css" rel="stylesheet"> after style.css on every page.
 */

/* ── Skip link ─────────────────────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  background: var(--color-primary, #1a56db);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 0.375rem 0.375rem;
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: 0;
  outline: 3px solid #fff;
  outline-offset: 2px;
}

/* ── Visible focus rings ────────────────────────────────────────────────────── */
/*
 * Provide a universally visible focus indicator that works on both
 * light and dark backgrounds (double-ring technique).
 */
:focus-visible {
  outline: 3px solid var(--color-primary, #1a56db);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.6);
  border-radius: 2px;
}

/* Remove default outline only when :focus-visible is supported */
:focus:not(:focus-visible) {
  outline: none;
}

/* Buttons and links inside booking cards */
.tab-btn:focus-visible,
.tab-btn-pill:focus-visible,
.btn-hero:focus-visible,
.btn-call:focus-visible,
.btn-whatsapp:focus-visible,
.bottom-nav-link:focus-visible {
  outline: 3px solid var(--color-primary, #1a56db);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.7);
}

/* ── Reduced motion ─────────────────────────────────────────────────────────── */
@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 support ──────────────────────────────────────────────────── */
@media (forced-colors: active) {
  .btn-hero,
  .btn-call,
  .btn-whatsapp {
    border: 2px solid ButtonText;
  }
  .brand-logo-link {
    border: 1px solid ButtonText;
  }
}

/* ── Typography and readability ─────────────────────────────────────────────── */
/* Ensure minimum 4.5:1 contrast ratio for body text */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Prevent tiny text that's hard to read when zoomed */
.text-muted-brand {
  font-size: max(0.75rem, 12px);
}

/* Improve touch target sizes (WCAG 2.5.5 — at least 44×44 px) */
.bottom-nav-link {
  min-height: 44px;
  min-width: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.tab-btn,
.tab-btn-pill {
  min-height: 44px;
}

.btn-hero,
.btn-call,
.btn-whatsapp {
  min-height: 48px;
}

/* Field labels — keep tappable */
.field-label {
  min-height: 48px;
}

/* ── Breadcrumb navigation ──────────────────────────────────────────────────── */
.breadcrumb-nav {
  opacity: 1;
}

.breadcrumb-item + .breadcrumb-item::before {
  content: "›";
  color: rgba(255, 255, 255, 0.6);
}

.breadcrumb-item a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.breadcrumb-item a:hover,
.breadcrumb-item a:focus {
  color: #fff;
}

/* ── Form accessibility ─────────────────────────────────────────────────────── */
/* Error state (JS applies .is-invalid) */
.field-label:has(input.is-invalid),
.field-label:has(select.is-invalid) {
  border-color: #dc3545;
  box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

/* Accessible error message */
.field-error {
  color: #dc3545;
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* ── Screen-reader utilities ────────────────────────────────────────────────── */
/* Bootstrap's .visually-hidden is used throughout; ensure it's present */
.visually-hidden,
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ── 200% zoom support ──────────────────────────────────────────────────────── */
@media (max-width: 320px) {
  .booking-card {
    padding: 1rem;
  }
  .tab-group.cols-3 {
    flex-wrap: wrap;
  }
  .hero-content h1 {
    font-size: 1.5rem;
  }
}

/* Ensure horizontal scrolling never occurs at any zoom level */
html {
  overflow-x: hidden;
}

/* ── Active nav state ───────────────────────────────────────────────────────── */
.bottom-nav-link.active,
.bottom-nav-link[aria-current="page"] {
  /* Ensure colour alone is not the only indicator (add underline) */
  text-decoration: none;
  position: relative;
}

.bottom-nav-link.active::after,
.bottom-nav-link[aria-current="page"]::after {
  content: "";
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  border-radius: 2px;
  background: var(--color-primary, #1a56db);
}
