/* ==========================================================================
   RTL (Right-to-Left) Language Support - Hebrew
   Layout transformations and logical property overrides
   Applied when dir="rtl" on html element
   ========================================================================== */

/* ==========================================================================
   HTML & BODY RTL BASE
   ========================================================================== */

[dir="rtl"] {
  /* Ensure proper base direction for all content */
  text-align: start; /* Logical equivalent of left in LTR, right in RTL */

  /* Apply Hebrew fonts when RTL is active */
  --font-family-body: var(--font-family-sans-he);
  --font-family-heading: var(--font-family-serif-he);
}

/* ==========================================================================
   TYPOGRAPHY & TEXT ALIGNMENT
   ========================================================================== */

[dir="rtl"] .hero__title {
  /* Title lines should maintain left-to-right flow for English words */
  direction: ltr;
}

[dir="rtl"] .blog-card__meta {
  direction: rtl;
  text-align: start;
}

[dir="rtl"] .post__meta {
  display: flex;
  gap: var(--space-6);
}

/* Blog post content RTL */
[dir="rtl"] .post__content {
  direction: rtl;
  text-align: start;
}

/* Code blocks should maintain LTR for code, but allow RTL for comments */
[dir="rtl"] .post__content pre {
  direction: ltr;
  text-align: left;
}

/* Lists in Hebrew posts */
[dir="rtl"] .post__content ul,
[dir="rtl"] .post__content ol {
  padding-right: var(--space-8);
  padding-left: 0;
}

/* Blockquotes in Hebrew */
[dir="rtl"] .post__content blockquote {
  border-left: none;
  border-right: 4px solid var(--color-primary-500);
  padding-left: 0;
  padding-right: var(--space-6);
}

[dir="rtl"][data-theme='dark'] .post__content blockquote {
  border-right-color: var(--color-primary-400);
}

/* ==========================================================================
   NAVIGATION RTL TRANSFORMS
   ========================================================================== */

/* Navigation container */
[dir="rtl"] .nav__container {
  direction: rtl;
}

/* Logo alignment */
[dir="rtl"] .nav__logo {
  direction: ltr;
}

/* Mobile menu overlay - full RTL layout */
[dir="rtl"] .nav__menu--mobile {
  direction: rtl;
}

[dir="rtl"] .nav__menu--mobile li {
  text-align: right;
}

/* Navigation actions (theme + language toggles) */
[dir="rtl"] .nav__actions {
  flex-direction: row;
}

/* Hamburger menu animations - RTL transformations */
[dir="rtl"] .nav__hamburger.active::before {
  /* Top line rotates counter-clockwise for RTL */
  transform: rotate(-45deg) translateY(11px) scaleX(-1);
}

[dir="rtl"] .nav__hamburger.active::after {
  /* Bottom line rotates clockwise for RTL */
  transform: rotate(45deg) translateY(-11px) scaleX(-1);
}

/* ==========================================================================
   HERO SECTION RTL
   ========================================================================== */

/* Hero container grid */
[dir="rtl"] .hero__container {
  direction: rtl;
}

/* Hero content block */
[dir="rtl"] .hero__content {
  text-align: start;
}

/* Hero actions (buttons) */
[dir="rtl"] .hero__actions {
  justify-content: flex-start;
}

/* ==========================================================================
   WELCOME SECTION RTL
   ========================================================================== */

/* Welcome content grid */
[dir="rtl"] .welcome__content {
  direction: rtl;
}

/* ==========================================================================
   ABOUT SECTION RTL
   ========================================================================== */

/* About content grid - reverse image/text order */
[dir="rtl"] .about__content {
  direction: rtl;
}

[dir="rtl"] .about__image {
  text-align: start;
}

/* ==========================================================================
   SERVICES SECTION RTL
   ========================================================================== */

/* Service cards grid */
[dir="rtl"] .services__grid {
  direction: rtl;
}

/* Individual service cards */
[dir="rtl"] .service-card__icon {
  /* Rotate icons that need flipping (arrows, etc.) */
  /* Service icons are generally universal, but arrows would need: */
  /* transform: scaleX(-1); */
}

/* ==========================================================================
   PERFORMANCE SECTION RTL
   ========================================================================== */

/* Performance stats grid */
[dir="rtl"] .performance__grid {
  direction: rtl;
}

[dir="rtl"] .performance__stat {
  text-align: center;
}

[dir="rtl"] .performance__stat-number {
  /* Numbers stay LTR */
  direction: ltr;
}

/* ==========================================================================
   PORTFOLIO SECTION RTL
   ========================================================================== */

/* Portfolio grid */
[dir="rtl"] .portfolio__grid {
  direction: rtl;
}

/* Portfolio cards */
[dir="rtl"] .portfolio-card {
  direction: rtl;
}

[dir="rtl"] .portfolio-card__content {
  text-align: start;
}

/* ==========================================================================
   BLOG SECTION RTL
   ========================================================================== */

/* Blog grid */
[dir="rtl"] .blog-preview__grid {
  direction: rtl;
}

/* Blog cards */
[dir="rtl"] .blog-card {
  direction: rtl;
}

[dir="rtl"] .blog-card__meta {
  justify-content: flex-start;
}

[dir="rtl"] .blog-card__category {
  /* Categories maintain their styling */
}

[dir="rtl"] .blog-card__content {
  text-align: start;
}

/* ==========================================================================
   FAQ SECTION RTL
   ========================================================================== */

[dir="rtl"] .faq__container {
  direction: rtl;
}

[dir="rtl"] .faq-card {
  text-align: start;
}

[dir="rtl"] .faq-card__question::before {
  left: auto;
  right: 0;
}

[dir="rtl"] .faq-card__answer {
  border-left: none;
  border-right: 3px solid var(--color-neutral-200);
}

[dir="rtl"][data-theme='dark'] .faq-card__answer {
  border-right-color: var(--color-neutral-600);
}

[dir="rtl"] .faq-card__answer::before {
  left: auto;
  right: var(--space-8);
}

/* ==========================================================================
   CONTACT SECTION RTL
   ========================================================================== */

/* Contact container */
[dir="rtl"] .contact__content {
  direction: rtl;
}

/* Contact info */
[dir="rtl"] .contact__info {
  text-align: start;
}

/* Contact details */
[dir="rtl"] .contact__details {
  direction: rtl;
  justify-content: flex-start;
}

[dir="rtl"] .contact__detail {
  text-align: start;
}

/* Form RTL */
[dir="rtl"] .contact__form {
  direction: rtl;
}

[dir="rtl"] .contact__form-grid {
  direction: rtl;
}

[dir="rtl"] .form-group {
  text-align: start;
}

[dir="rtl"] .form-label {
  text-align: start;
}

[dir="rtl"] .form-input,
[dir="rtl"] .form-select,
[dir="rtl"] .form-textarea {
  text-align: start;
}

[dir="rtl"] .contact__submit {
  /* Submit button positioning may need adjustment based on layout */
}

/* ==========================================================================
   FOOTER RTL
   ========================================================================== */

[dir="rtl"] .footer__container {
  direction: rtl;
}

[dir="rtl"] .footer__content {
  direction: rtl;
}

[dir="rtl"] .footer__brand {
  text-align: start;
}

[dir="rtl"] .footer__nav {
  text-align: start;
}

[dir="rtl"] .footer__nav-section {
  text-align: start;
}

[dir="rtl"] .footer__nav-list {
  text-align: start;
}

[dir="rtl"] .footer__nav-list li {
  text-align: start;
}

[dir="rtl"] .footer__bottom {
  direction: rtl;
  justify-content: space-between;
}

[dir="rtl"] .footer__legal {
  flex-direction: row-reverse;
}

/* ==========================================================================
   COMPONENT RTL OVERRIDES
   ========================================================================== */

/* Buttons */
[dir="rtl"] .btn {
  direction: rtl;
}

/* Service cards */
[dir="rtl"] .service-card {
  text-align: start;
  direction: rtl;
}

/* Pricing cards */
[dir="rtl"] .pricing-package li::before {
  left: auto;
  right: 0;
}

[dir="rtl"] .performance__benefits-list li::before {
  left: auto;
  right: 0;
}

/* Individual components may need specific overrides */
[dir="rtl"] .portfolio-card {
  text-align: start;
  direction: rtl;
}

[dir="rtl"] .blog-card {
  text-align: start;
  direction: rtl;
}

[dir="rtl"] .contact__expectations li::before {
  left: auto;
  right: 0;
}

/* ==========================================================================
   LOGICAL PROPERTIES FOR UNIVERSAL RTL SUPPORT
   ========================================================================== */

/* These use modern logical properties that automatically flip in RTL */

/* Instead of left/right margins, use inline versions: */
.margin-inline-start { margin-inline-start: var(--space-4); }
.margin-inline-end { margin-inline-end: var(--space-4); }

/* Instead of left/right padding: */
.padding-inline-start { padding-inline-start: var(--space-4); }
.padding-inline-end { padding-inline-end: var(--space-4); }

/* Instead of left/right borders: */
.border-inline-start { border-inline-start: 1px solid var(--color-neutral-300); }
.border-inline-end { border-inline-end: 1px solid var(--color-neutral-300); }

/* Positioning */
.inset-inline-start { inset-inline-start: 0; }
.inset-inline-end { inset-inline-end: 0; }

/* Text alignment */
.text-start { text-align: start; }
.text-end { text-align: end; }

/* Float */
.float-start { float: inline-start; }
.float-end { float: inline-end; }

/* ==========================================================================
   MOBILE RTL SPECIFIC ADJUSTMENTS
   ========================================================================== */

@media (max-width: 767px) {
  [dir="rtl"] .nav__container {
    padding-inline: var(--space-6);
  }

  [dir="rtl"] .hero__container {
    padding-inline: var(--space-6);
  }

  [dir="rtl"] .welcome__content {
    flex-direction: column-reverse; /* Stack in RTL preferred order */
  }
}

/* Force mobile menu hidden on tablet+ regardless of RTL */
@media (min-width: 768px) {
  [dir="rtl"] .nav__menu--mobile {
    display: none !important; /* Force hidden on tablet+ */
  }
}


/* ==========================================================================
   RESPONSIVE RTL GRIDS
   ========================================================================== */

/* Grid items naturally flow RTL */
[dir="rtl"] .grid-cols-2 { grid-auto-flow: dense; }
[dir="rtl"] .grid-cols-3 { grid-auto-flow: dense; }
[dir="rtl"] .grid-cols-4 { grid-auto-flow: dense; }

/* ==========================================================================
   ICONS & VISUAL ELEMENTS RTL
   ========================================================================== */

/* Arrow icons may need flipping in RTL context */
[dir="rtl"] .icon-arrow-left::before {
  transform: scaleX(-1);
}

[dir="rtl"] .icon-arrow-right::before {
  transform: scaleX(-1);
}

/* Chevron/arrow elements */
[dir="rtl"] .chevron-left::before {
  transform: scaleX(-1);
}

/* ==========================================================================
   ACCESSIBILITY RTL CONSIDERATIONS
   ========================================================================== */

/* Skip links */
[dir="rtl"] .skip-link {
  right: auto;
  left: 6px;
}

/* Focus outlines should respect RTL */
[dir="rtl"] *:focus-visible {
  outline-offset: -2px;
}

/* ==========================================================================
   ANIMATIONS & TRANSITIONS RTL
   ========================================================================== */

/* Mobile menu slide animations for RTL */
[dir="rtl"] .nav__menu--mobile {
  /* Hide off-screen to the right (same direction as LTR) to avoid left overflow in RTL */
  transform: translateX(100%);
}

[dir="rtl"] .nav__menu--mobile.mobile-menu-open {
  /* RTL slide from the right */
  transform: translateX(0%);
}

/* ==========================================================================
   PRICING - Subscription Plan Label
   ========================================================================== */

[dir="rtl"] .pricing-grid .pricing-package:nth-child(2)::before {
  content: 'מינוי חודשי';
}
