/*
 * enhancements.css - accessibility, keyboard focus, reduced-motion support and small additions.
 * Loaded AFTER style.css, so it only adds to or gently overrides the main styles.
 */

/* ---- Skip link (first thing a keyboard user can reach) ---- */
.skip-link {
  position: absolute;
  top: -80px;
  left: 12px;
  z-index: 10001;
  padding: 10px 18px;
  background: var(--color-primary);
  color: #fff;
  border-radius: var(--r-md);
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transition: top var(--ease-fast);
}
[dir="rtl"] .skip-link { left: auto; right: 12px; }
.skip-link:focus { top: 12px; }

/* ---- Visible keyboard focus ---- */
:where(a, button, input, select, textarea, summary, [role="button"], [tabindex]):focus-visible {
  outline: 3px solid var(--color-accent-light);
  outline-offset: 3px;
}
.btn:focus-visible,
.doctor-profile-btn:focus-visible,
.service-card:focus-visible { outline-color: var(--color-highlight); }
.ortho-card:focus-visible { outline: 3px solid var(--color-accent-light); outline-offset: 4px; }
.progress-bar:focus-visible { outline: 3px solid var(--color-highlight); outline-offset: 6px; }
.ba-slider__handle:focus-visible { outline: 3px solid var(--color-accent-light); outline-offset: 2px; }
.lightbox__close:focus-visible { outline: 3px solid #fff; outline-offset: 4px; border-radius: 4px; }
.booking-option input:focus-visible + .booking-option__box { outline: 3px solid var(--color-highlight); outline-offset: 2px; }
/* Sections that receive focus after a menu jump should not show a ring. */
[tabindex="-1"]:focus { outline: none; }

/* ---- Menu jumps stop below the sticky header ---- */
section[id], main[id] { scroll-margin-top: calc(var(--header-height) + 24px); }

/* ---- Arabic letters must stay joined: no letter-spacing in RTL ---- */
[dir="rtl"] body, [dir="rtl"] body * { letter-spacing: 0 !important; }

/* ---- Service cards: equal layout, readable "Coming Soon" pill at the bottom ---- */
.services__grid .service-card { position: relative; display: flex; flex-direction: column; align-items: center; }
.service-card--soon p { margin-bottom: var(--space-4); }
.service-card--soon .service-card__arrow { display: none; }
.service-card__coming-soon-badge,
[dir="rtl"] .service-card__coming-soon-badge {
  position: static;
  order: 9;
  margin-top: auto;
  padding: 5px 12px;
  background: rgba(15, 42, 68, 0.07);
  border: 1px solid rgba(15, 42, 68, 0.12);
  color: var(--color-primary);
  font-size: .72rem;
  letter-spacing: .06em;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  transition: background var(--ease-normal), color var(--ease-normal), border-color var(--ease-normal);
}
.service-card__coming-soon-badge i { font-size: .7rem; animation: none; }
.service-card--soon:hover .service-card__coming-soon-badge,
.service-card--soon:focus-visible .service-card__coming-soon-badge {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ---- Short pages (coming soon, 404): footer stays at the bottom of the screen ---- */
.page-short { min-height: 100vh; display: flex; flex-direction: column; }
.page-short main { flex: 1; display: flex; flex-direction: column; }
.page-short main > section { flex: 1; }

/* ---- Coming-soon page ---- */
.cs {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--header-height) + var(--space-16)) var(--space-5) var(--space-16);
  background: var(--gradient-hero);
}
.cs__card {
  width: 100%;
  max-width: 560px;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--r-2xl);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow-xl);
  animation: fadeUp .45s cubic-bezier(0.2, 0, 0, 1) both;
}
.cs__icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto var(--space-5);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--color-highlight);
  font-size: 1.8rem;
}
.cs__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: var(--space-4);
  padding: 5px 14px;
  border-radius: var(--r-full);
  background: rgba(142, 176, 209, 0.18);
  color: var(--color-highlight);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
}
.cs__title { margin-bottom: var(--space-3); color: #fff; font-size: clamp(1.6rem, 4vw, 2.2rem); font-weight: var(--fw-bold); line-height: 1.25; }
.cs__service-desc { margin-bottom: var(--space-4); color: #fff; opacity: .92; font-size: var(--fs-md); line-height: 1.6; }
.cs__desc { margin-bottom: var(--space-8); color: var(--color-text-white); opacity: .75; font-size: var(--fs-sm); line-height: 1.7; }
.cs__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-3); }
.cs__actions .btn { width: auto; margin-top: 0; padding: .85rem 1.6rem; font-size: var(--fs-sm); }
.cs__back { justify-content: center; background: transparent; border: 1.5px solid rgba(255, 255, 255, 0.4); color: #fff; }
.page-short .header__actions .btn { width: auto; padding: .5rem 1rem; font-size: var(--fs-xs); }
.nf__actions { align-items: center; }
.nf__actions .btn { width: auto; margin-top: 0; justify-content: center; }
.cs__back:hover { background: rgba(255, 255, 255, 0.12); }
@media (max-width: 480px) {
  .cs__card { padding: var(--space-8) var(--space-5); }
  .cs__actions .btn { width: 100%; }
}

/* ---- Video controls: visible while paused, with keyboard focus, and always on touch screens ---- */
.custom-video-container.is-paused .custom-video-controls,
.custom-video-container:focus-within .custom-video-controls { opacity: 1; transform: none; }
@media (hover: none) { .custom-video-controls { opacity: 1; transform: none; } }

/* ---- Instagram widget: reserve its height so the page does not jump when it loads ---- */
.instagram-feed [class*="elfsight-app"] { min-height: 1040px; }
@media (max-width: 600px) { .instagram-feed [class*="elfsight-app"] { min-height: 1100px; } }
.instagram-feed.is-unavailable [class*="elfsight-app"] { min-height: 0; }
.ig-fallback { margin-top: var(--space-6); text-align: center; }
.ig-fallback .btn { width: auto; }

/* ---- FAQ: long answers (Arabic, phones) were cut off at 300px ---- */
.faq-item.is-open .faq-item__answer { max-height: 1200px; }

/* ---- "Back" arrows point the reading direction in Arabic ---- */
[dir="rtl"] .header__actions .fa-arrow-left,
[dir="rtl"] .cs__back .fa-arrow-left { transform: scaleX(-1); }

/* ---- Snappier pop-ups ---- */
.doctor-modal { transition: opacity .18s ease, visibility .18s ease; }
.doctor-modal__content { transition: transform .24s var(--ease-out-back); }

/* ---- Doctors carousel: pause button ---- */
.doctors-carousel-wrapper { position: relative; }
.carousel-pause {
  position: absolute;
  bottom: -52px;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-white);
  color: var(--color-primary);
  font-size: .85rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background var(--ease-fast), color var(--ease-fast);
}
.carousel-pause:hover { background: var(--color-primary); color: #fff; }
.doctors-carousel .doctor-card.is-clone { cursor: pointer; }

/* ---- Floating WhatsApp button ---- */
.wa-fab {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 900;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--color-whatsapp);
  color: #fff;
  font-size: 1.9rem;
  text-decoration: none;
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
  transition: transform var(--ease-fast), box-shadow var(--ease-fast);
}
[dir="rtl"] .wa-fab { right: auto; left: 16px; }
.wa-fab:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 10px 26px rgba(37, 211, 102, 0.5); }
.wa-fab:focus-visible { outline: 3px solid #fff; outline-offset: 3px; box-shadow: 0 0 0 6px var(--color-primary); }

/* ---- Booking validation message ---- */
.booking-error { font-weight: var(--fw-medium); }

/* ---- Easier-to-read small text ---- */
.ortho-card__features li i { font-size: .78rem; }

/* ---- Respect "reduce motion" system setting ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal, .hero-animate-1, .hero-animate-2, .hero-animate-3, .hero-animate-4, .hero-animate-img {
    opacity: 1 !important;
    transform: none !important;
  }
}
