/**
 * עיצוב אחיד להדר ופוטר – מקור יחיד לכל הדפים שמשתמשים ב-includes/header.html ו-includes/footer.html
 * חובה לטעון קובץ זה בכל דף שיש בו סימוני HEADER/FOOTER.
 * A11y: skip link, focus, touch targets, no horizontal scroll.
 */

/* Prevent horizontal scroll on small screens; consistent mobile viewport (375px–430px) */
body { overflow-x: hidden; }
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
/* Mobile layout audit: no overflow, consistent horizontal padding for narrow screens */
@media (max-width: 430px) {
  body { min-width: 0; }
  #header.header-premium .header-inner,
  main .max-w-5xl,
  main .max-w-6xl,
  main .max-w-4xl { padding-left: 1rem !important; padding-right: 1rem !important; }
  img, video, iframe { max-width: 100%; height: auto; }
}

/* Skip to main content – visible on focus for keyboard users (WCAG 2.4.1) */
.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  z-index: 9999;
}
.skip-link:focus {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  width: auto;
  height: auto;
  padding: 0.75rem 1.25rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: #002147;
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  border-radius: 9999px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(0, 33, 71, 0.35);
  outline: 2px solid #fff;
  outline-offset: 2px;
}
[dir="ltr"] .skip-link:focus { right: auto; left: 0.75rem; }

/* Placeholder לפני טעינת קומפוננטת ההדר – מונע קפיצת layout */
#header-placeholder { min-height: 5rem; }
@media (min-width: 768px) { #header-placeholder { min-height: 5.5rem; } }

/* Smooth scroll + anchor targets: scroll lands exactly at section start below sticky header */
html { scroll-behavior: smooth; scroll-padding-top: 5.5rem; }
@media (min-width: 768px) { html { scroll-padding-top: 6rem; } }
/* Section/article with id – scroll-margin-top = header height so target is not under header */
section[id], article[id] { scroll-margin-top: 5.5rem; }
@media (min-width: 768px) { section[id], article[id] { scroll-margin-top: 6rem; } }
/* Contact: slightly less offset so "איך להגיע" heading is visible right below header */
#contact { scroll-margin-top: 5rem; }
@media (min-width: 768px) { #contact { scroll-margin-top: 5.5rem; } }
/* טופס השאירו פרטים – ריווח גלילה כדי שלא יקפוץ עד למטה */
#contact-form { scroll-margin-top: 5.5rem; scroll-margin-bottom: 3rem; }
@media (min-width: 768px) { #contact-form { scroll-margin-top: 6rem; scroll-margin-bottom: 4rem; } }

/* ========== Header: 3-section flexbox, RTL – רווחים קבועים ואחידים בכל הדפים (גובר על Tailwind) ========== */
#header.header-premium .header-inner {
  padding: 1rem !important;
  max-width: 72rem !important;
  margin-left: auto !important;
  margin-right: auto !important;
  box-sizing: border-box;
}
@media (min-width: 640px) {
  #header.header-premium .header-inner { padding-left: 1.5rem !important; padding-right: 1.5rem !important; }
}
#header.header-premium .header-row {
  display: flex !important;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  gap: 1.5rem !important;
}
#header .header-actions {
  gap: 0.75rem !important;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}
@media (min-width: 768px) {
  #header .header-actions { gap: 1rem !important; }
}

/* Right section (RTL): Logo + Brand – margin between image and text, רווח מהניווט */
#header .header-logo-wrap {
  gap: 0.75rem;
  min-width: 0;
  margin-inline-end: 1rem;
}
@media (min-width: 768px) {
  #header .header-logo-wrap { margin-inline-end: 2rem; }
}
#header .header-logo-img {
  width: 44px;
  height: 44px;
  margin-inline-end: 0;
}
#header .header-brand-name {
  font-size: 1.0625rem;
  font-weight: 600;
  color: #002147;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 639px) {
  #header .header-brand-name { display: none; }
}

/* Center section: Menu – 2rem gap, desktop only, רווח מהלוגו */
#header .header-nav {
  display: none;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  margin-inline-end: 1rem;
}
@media (min-width: 768px) {
  #header .header-nav { display: flex !important; }
}
#header .header-nav-link {
  font-size: 1rem;
  font-weight: 500;
  color: rgba(0, 33, 71, 0.88);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0;
  position: relative;
  transition: color 0.2s ease;
}
#header .header-nav-link:hover { color: #0056b3; }
/* אנימציה: קו תחתון ב-hover */
#header .header-nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: #0056b3;
  transform: scaleX(0);
  transition: transform 0.2s ease;
  border-radius: 1px;
}
#header .header-nav-link:hover::after,
#header .header-nav-link:focus-visible::after {
  transform: scaleX(1);
}
#header .header-nav-link:focus-visible {
  outline: 2px solid #002147;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Left section: שפות + CTA בדסקטופ; המבורגר רק במובייל */
@media (min-width: 768px) {
  #header .header-lang { display: flex !important; }
  #header .header-cta-btn { display: inline-flex !important; }
}
#header .header-lang,
#header .lang-switcher {
  gap: 0.25rem;
  align-items: center;
}
#header .header-lang .lang-link {
  padding: 0.35rem 0.5rem;
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(0, 33, 71, 0.65);
  text-decoration: none;
  transition: color 0.2s ease;
  border-radius: 6px;
}
#header .header-lang .lang-link:focus-visible {
  outline: 2px solid #002147;
  outline-offset: 2px;
}
#header .header-lang .lang-link:hover,
#header .header-lang .lang-link.active { color: #002147; }
#header .header-lang .lang-sep {
  width: 1px;
  height: 0.875rem;
  background: rgba(0, 33, 71, 0.18);
  margin: 0 0.2rem;
}

/* CTA: small pill, one line, no harsh shadow */
#header .header-cta-btn {
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: #002147;
  border-radius: 9999px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease;
}
#header .header-cta-btn:hover { background: #0056b3; }
#header .header-cta-btn:focus-visible {
  outline: 2px solid #002147;
  outline-offset: 2px;
}

/* Hamburger: רק במובייל – מוסתר מדסקטופ */
#header .header-hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #002147;
  cursor: pointer;
}
@media (min-width: 768px) {
  #header .header-hamburger { display: none !important; }
}
#header .header-hamburger:hover { background: rgba(0, 33, 71, 0.06); }
#header .header-hamburger .hamburger-line {
  width: 22px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
#header .header-hamburger[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
#header .header-hamburger[aria-expanded="true"] .hamburger-line:nth-child(2) { opacity: 0; }
#header .header-hamburger[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* Mobile menu panel */
#header .header-mobile {
  background: #fafbfc;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1rem 1.25rem 1.5rem;
}
#header .header-mobile-lang {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}
#header .header-mobile-lang .lang-link {
  padding: 0.5rem 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: rgba(0, 33, 71, 0.7);
  text-decoration: none;
}
#header .header-mobile-lang .lang-sep {
  width: 1px;
  height: 0.875rem;
  background: rgba(0, 33, 71, 0.2);
}
#header .mobile-nav-link {
  display: flex;
  align-items: center;
  padding: 0.75rem 0.5rem;
  font-size: 1rem;
  font-weight: 500;
  color: #002147;
  text-decoration: none;
  min-height: 44px;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
}
#header .mobile-nav-link:hover {
  background: rgba(0, 33, 71, 0.05);
  color: #0056b3;
}
#header .mobile-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: #002147;
  border-radius: 9999px;
  text-decoration: none;
  min-height: 44px;
  white-space: nowrap;
  transition: background 0.2s ease;
}
#header .mobile-cta:hover { background: #0056b3; }

/* Main content: clear fixed header (main לא צמוד ל-header – יש scripts ביניהם, לכן ~ ולא +) */
#header.header-premium ~ main { padding-top: 5rem; }
@media (min-width: 768px) {
  #header.header-premium ~ main { padding-top: 5.5rem; }
}

/* Sticky bar + Float – מראה אחיד */
.sticky-action-bar { display: flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.75rem 1rem; background: rgba(240, 247, 255, 0.95); backdrop-filter: blur(8px); border-top: 1px solid rgba(0, 86, 179, 0.1); position: sticky; bottom: 0; z-index: 30; }
@media (min-width: 768px) { .sticky-action-bar { display: none; } }
/* פס תחתון – אייקונים transparent & flat כמו בפוטר (טלפון + וואטסאפ בירוק) */
.sticky-action-bar--icons { gap: 1rem; }
.sticky-bar-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border-radius: 50%; padding: 0; text-decoration: none;
  background: rgba(0, 33, 71, 0.12);
  color: #002147;
  box-shadow: none;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.sticky-bar-icon:hover {
  transform: scale(1.1);
  background: rgba(0, 86, 179, 0.2);
  color: #0056b3;
}
.sticky-bar-icon--wa {
  background: rgba(37, 211, 102, 0.2);
  color: #1a9f4a;
}
.sticky-bar-icon--wa:hover {
  background: rgba(37, 211, 102, 0.35);
  color: #25D366;
}
.sticky-bar-icon .fa-icon { font-size: 1.15rem; }
.sticky-bar-icon:focus-visible { outline: 2px solid #002147; outline-offset: 2px; }
.sticky-bar-icon--wa:focus-visible { outline-color: #25D366; }

/* Blog page – תמונות ו־hero (נטען ב־layout כדי שיעבוד גם בניווט SPA) */
.blog-hero {
  background-image: linear-gradient(135deg, rgba(0, 33, 71, 0.55) 0%, rgba(0, 54, 120, 0.35) 50%, rgba(0, 33, 71, 0.5) 100%), url('https://images.pexels.com/photos/3845983/pexels-photo-3845983.jpeg?auto=compress&cs=tinysrgb&w=1200');
  background-size: cover;
  background-position: center;
}
.blog-card-img { background-size: cover; background-position: center; }
/* כרטיס 1: שיננית / dental hygienist */
.blog-card-img-1 { background-image: linear-gradient(180deg, rgba(0, 33, 71, 0.15) 0%, transparent 60%), url('https://images.pexels.com/photos/3845808/pexels-photo-3845808.jpeg?auto=compress&cs=tinysrgb&w=800'); }
/* כרטיס 2: השתלת שיניים / dental implants */
.blog-card-img-2 { background-image: linear-gradient(180deg, rgba(0, 33, 71, 0.15) 0%, transparent 60%), url('https://images.pexels.com/photos/3845764/pexels-photo-3845764.jpeg?auto=compress&cs=tinysrgb&w=800'); }
/* כרטיס 3: ציפוי חרסינה / porcelain veneers */
.blog-card-img-3 { background-image: linear-gradient(180deg, rgba(0, 33, 71, 0.15) 0%, transparent 60%), url('https://images.pexels.com/photos/3845810/pexels-photo-3845810.jpeg?auto=compress&cs=tinysrgb&w=800'); }
/* כרטיס 4: טיפול שורש / root canal */
.blog-card-img-4 { background-image: linear-gradient(180deg, rgba(0, 33, 71, 0.15) 0%, transparent 60%), url('https://images.pexels.com/photos/4270379/pexels-photo-4270379.jpeg?auto=compress&cs=tinysrgb&w=800'); }
/* כרטיס 5: חירום דנטלי / dental emergency */
.blog-card-img-5 { background-image: linear-gradient(180deg, rgba(0, 33, 71, 0.15) 0%, transparent 60%), url('https://images.pexels.com/photos/6627447/pexels-photo-6627447.jpeg?auto=compress&cs=tinysrgb&w=800'); }
/* כרטיס 6: הלבנת שיניים בחיפה / teeth whitening Haifa */
.blog-card-img-6 { background-image: linear-gradient(180deg, rgba(0, 33, 71, 0.15) 0%, transparent 60%), url('https://images.pexels.com/photos/3845624/pexels-photo-3845624.jpeg?auto=compress&cs=tinysrgb&w=800'); }
.blog-hero .text-shadow { text-shadow: 0 2px 4px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.35); }

/* Gallery – גריד, כרטיסים ו-lightbox (נטען ב־layout כדי שיעבוד גם בניווט SPA) */
.gallery-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .gallery-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}
@media (min-width: 1024px) {
  .gallery-grid { grid-template-columns: repeat(3, 1fr); gap: 1.75rem; }
}
.gallery-card {
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 4px 20px rgba(0, 33, 71, 0.08);
  transition: transform 0.35s ease, box-shadow 0.35s ease;
}
.gallery-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 12px 32px rgba(0, 33, 71, 0.12);
}
.gallery-card:focus-within { outline: 2px solid #0056b3; outline-offset: 2px; }
.gallery-card__img-wrap {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}
.gallery-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform 0.4s ease;
}
.gallery-card:hover .gallery-card__img-wrap img {
  transform: scale(1.06);
}
.gallery-card__trigger {
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  font: inherit;
}
.gallery-card__caption {
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: #002147;
  text-align: right;
}
[dir="ltr"] .gallery-card__caption { text-align: left; }
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 33, 71, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}
.lightbox-backdrop.is-open {
  opacity: 1;
  visibility: visible;
}
.lightbox-content {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.lightbox-content img {
  max-width: 100%;
  max-height: 75vh;
  width: auto;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.lightbox-caption {
  font-size: 1rem;
  font-weight: 500;
  color: #fff;
  text-align: center;
}
[dir="rtl"] .lightbox-caption { text-align: center; }
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 44px;
  height: 44px;
  border: none;
  background: rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: background 0.2s ease;
}
[dir="rtl"] .lightbox-close { right: auto; left: 1rem; }
.lightbox-close:hover { background: rgba(255,255,255,0.35); }
.lightbox-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* Touch targets: minimum 44x44px for interactive elements (WCAG 2.5.5) */
.sticky-action-bar a,
.header-cta-btn,
.mobile-cta,
.mobile-nav-link {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.footer-social-icon {
  min-width: 44px;
  min-height: 44px;
}

/* Global focus-visible for links/buttons that may not have explicit outline */
a:focus-visible,
button:focus-visible {
  outline: 2px solid #0056b3;
  outline-offset: 2px;
  border-radius: 4px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible) { outline: none; }
