/*
Theme Name: Bahur Books
Theme URI: https://bahurbooks.webcom.co.il
Author: Webcom
Author URI: https://webcom.co.il
Description: תבנית מותאמת אישית להוצאת ספרים איתי בחור - ספרים, אמנות ופרויקטים תרבותיים
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.0
License: Private
Text Domain: bahurbooks
Tags: rtl-language, woocommerce 
*/

/* ========================
   GLOBAL 12.5% SCALE
   ========================
   Sets the root font-size to 18px (instead of browser default 16px).
   All rem-based Tailwind utilities (text-*, p-*, m-*, gap-*, space-*, etc.)
   automatically scale up by 12.5%.
   Note: Tailwind `screens` (px-based) are scaled separately in functions.php.
   ======================== */
html { font-size: 18px; }

/* ========================
   BASE RESET & DIRECTION
   ======================== */
/* direction is inherited from <html dir="…"> which language_attributes() sets per locale.
   אל תקבעו direction:rtl ידנית — זה ידרוס את LTR שמגיע ב-Polylang אנגלית. */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
::-webkit-scrollbar { display: none; }

/* Tailwind utility override */
.shadow-lg { box-shadow: none !important; }

/* ========================
   TYPOGRAPHY
   ======================== */
body {
    font-family: 'Assistant', sans-serif;
    color: #1f2937;
    line-height: 1.8;
}
h1, h2, h3, h4, h5, h6 {
    font-family: 'Karantina', sans-serif;
}
.title-font { font-family: 'Karantina', sans-serif; }

/* תוכן מעוצב (תקציר מוצר, WYSIWYG) — איטליק/מודגש בתוך HTML.
   הערה: Tailwind CDN preflight מאפס margin של <p>, ולכן שתי פסקאות נדבקות
   זו לזו ונראות כשורה אחת בלי הפסק. מחזירים מרווח טבעי כאן. */
.bahurbooks-rich-text p {
    margin-bottom: 1em;
}
.bahurbooks-rich-text p:last-child {
    margin-bottom: 0;
}
/* פונט Assistant לא נטען עם וריאנט italic, ולכן Chrome/Safari עשויים
   להתעלם מהטיית-em ברירת-המחדל. font-synthesis מאפשר את הסינתזה,
   ו-font-style מחיל זאת מפורשות. */
.bahurbooks-rich-text em,
.bahurbooks-rich-text i:not([class*="fa-"]) {
    font-style: italic;
    font-synthesis: style;
}
.bahurbooks-rich-text strong,
.bahurbooks-rich-text b {
    font-weight: 700;
}

/* כיוון טקסט מ-TinyMCE (dir=ltr|rtl) בתוך תוכן מעורב */
.bahurbooks-rich-text [dir="ltr"] {
    direction: ltr;
    unicode-bidi: isolate;
    text-align: left;
}
.bahurbooks-rich-text [dir="rtl"] {
    direction: rtl;
    unicode-bidi: isolate;
    text-align: right;
}

/* הערה (2026-05-24): הוסר שכבת ה-`--bb-type-scale` (+18.5%) שהייתה
   על כל ה-.text-* utilities. כעת רק ה-12.5% scale של html{font-size:18px}
   פעיל — Tailwind text-xs יוצא 0.75rem * 18px = 13.5px במקום 16px,
   text-base = 18px במקום ~21.3px, וכן הלאה. כדי לשחזר את הסקייל הקודם
   ב-+33% יש להחזיר את הבלוק שנמחק (ראה git history של style.css). */

/* Arrows, list bullets, qty +/- — keep small icon size regardless of context */
i.fa-chevron-left,
i.fa-chevron-right,
i.fa-chevron-down,
i.fa-circle,
i.fa-minus,
i.fa-plus {
    font-size: 0.75rem !important;
}
i.fa-chevron-down.text-sm {
    font-size: 0.875rem !important;
}

/* ========================
   COLORS
   ======================== */
:root {
    --bahur-gray: #6B7280;
    --bahur-blue: #374151;
    --bahur-dark-gray: #374151;
    --bahur-light-gray: #F3F4F6;
    --brand-accent: #000000;
    --brand-dark: #1f2937;
    --brand-gray: #6b7280;
}

/* ========================
   WOOCOMMERCE OVERRIDES
   ======================== */
.woocommerce-notices-wrapper { display: none; }

.wc-block-components-notice-banner,
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
    font-family: 'Assistant', sans-serif;
}

/* יישור הודעות WC לפי כיוון העמוד */
html[dir="rtl"] .wc-block-components-notice-banner,
html[dir="rtl"] .woocommerce-message,
html[dir="rtl"] .woocommerce-info,
html[dir="rtl"] .woocommerce-error,
html[dir="rtl"] .woocommerce-cart table.cart,
html[dir="rtl"] .woocommerce-checkout form.checkout { text-align: right; }

html[dir="ltr"] .wc-block-components-notice-banner,
html[dir="ltr"] .woocommerce-message,
html[dir="ltr"] .woocommerce-info,
html[dir="ltr"] .woocommerce-error,
html[dir="ltr"] .woocommerce-cart table.cart,
html[dir="ltr"] .woocommerce-checkout form.checkout { text-align: left; }

/* Remove WC default styles that conflict */
.woocommerce .quantity input[type=number] { -moz-appearance: textfield; }
.woocommerce .quantity input::-webkit-inner-spin-button,
.woocommerce .quantity input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ========================
   SLIDER
   ======================== */
/* !important: Tailwind utility .grid על אותו אלמנט דורס display:none */
#hero-slider #slider-container > .slider-slide {
    display: none !important;
    width: 100%;
    height: 100%;
}
#hero-slider #slider-container > .slider-slide.active {
    display: grid !important;
    grid-template-rows: 60fr 24fr;
    width: 100%;
    height: 100%;
}

#slider-prev,
#slider-next {
    background: none;
    box-shadow: none;
    padding: 0;
}
#slider-prev:hover,
#slider-next:hover {
    background: none;
}
#slider-prev i.fa-chevron-right,
#slider-next i.fa-chevron-left {
    font-size: 1.5rem !important;
}

/* ========================
   THUMBNAIL GALLERY
   ======================== */
.thumbnail-item { cursor: pointer; }
.thumbnail-item.active { border-color: var(--brand-accent) !important; }

/* עמוד מוצר: text-sm = 16px (במקום 15.75px מה-scale של html) */
.single-product .max-w-screen-xl.mx-auto.px-8 .text-sm {
    font-size: 16px;
}

/* ========================
   MODALS
   ======================== */
.bahur-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}
.bahur-modal.open { display: flex; }

/* ========================
   MEGA MENU
   ======================== */
.mega-menu-wrapper:hover .mega-menu-dropdown {
    opacity: 1 !important;
    visibility: visible !important;
}

/* English only: top-level main nav — 16px instead of inherited 18px */
.bahur-lang-en #main-navigation > a,
.bahur-lang-en #main-navigation > .mega-menu-wrapper > a {
    font-size: 16px;
}
.bahur-lang-en #mobile-menu nav {
    font-size: 16px;
}

/* ========================
   EDITION SELECTOR
   ======================== */
#size-selector { display: none; }
#size-selector.visible { display: block; }

/* ========================
   MOBILE MENU
   ======================== */
#mobile-menu {
    display: none;
    position: fixed;
    inset: 0;
    background: white;
    z-index: 9998;
    overflow-y: auto;
    padding: 2rem;
}
#mobile-menu.open { display: block; }

/* ============================================================================
   LTR (ENGLISH) DIRECTION-AWARE OVERRIDES
   ============================================================================
   רוב התבניות נכתבו בעברית עם Tailwind utilities שאינן "logical":
     text-right, border-r-*, pr-*, mr-*, ml-*, space-x-reverse,
     ובאיקונים: fa-chevron-left / fa-arrow-left משמשים כ"קדימה" (RTL).

   כשהדף נטען בשפה אנגלית, Polylang מחליף את ה-locale וה-<html> מקבל
   dir="ltr" אוטומטית דרך language_attributes(). הבלוק הזה הופך את כל
   ה-utilities הפיזיים ל"לוגיים" כך שטקסט מיושר LEFT, פדינג/מרג'ין/בורדר
   עוברים לצד הנכון, והאיקונים מצביעים לכיוון הנכון.

   בעברית (RTL — ברירת מחדל) הקוד הזה לא מתפעל; הכל ממשיך לעבוד כמו שעבד. */

/* Text alignment — flip end↔start */
html[dir="ltr"] .text-right { text-align: left !important; }
html[dir="ltr"] .text-left  { text-align: right !important; }

/* Border side flips */
html[dir="ltr"] .border-r,
html[dir="ltr"] .border-r-2,
html[dir="ltr"] .border-r-4,
html[dir="ltr"] .border-r-8 {
    border-right-width: 0 !important;
}
html[dir="ltr"] .border-r   { border-left-width: 1px !important; }
html[dir="ltr"] .border-r-2 { border-left-width: 2px !important; }
html[dir="ltr"] .border-r-4 { border-left-width: 4px !important; }
html[dir="ltr"] .border-r-8 { border-left-width: 8px !important; }

html[dir="ltr"] .border-l,
html[dir="ltr"] .border-l-2,
html[dir="ltr"] .border-l-4,
html[dir="ltr"] .border-l-8 {
    border-left-width: 0 !important;
}
html[dir="ltr"] .border-l   { border-right-width: 1px !important; }
html[dir="ltr"] .border-l-2 { border-right-width: 2px !important; }
html[dir="ltr"] .border-l-4 { border-right-width: 4px !important; }
html[dir="ltr"] .border-l-8 { border-right-width: 8px !important; }

/* Padding side flips (pr-* ↔ pl-*) */
html[dir="ltr"] .pr-1  { padding-right: 0 !important; padding-left: 0.25rem !important; }
html[dir="ltr"] .pr-2  { padding-right: 0 !important; padding-left: 0.5rem  !important; }
html[dir="ltr"] .pr-3  { padding-right: 0 !important; padding-left: 0.75rem !important; }
html[dir="ltr"] .pr-4  { padding-right: 0 !important; padding-left: 1rem    !important; }
html[dir="ltr"] .pr-6  { padding-right: 0 !important; padding-left: 1.5rem  !important; }
html[dir="ltr"] .pr-8  { padding-right: 0 !important; padding-left: 2rem    !important; }
html[dir="ltr"] .pr-10 { padding-right: 0 !important; padding-left: 2.5rem  !important; }
html[dir="ltr"] .pr-12 { padding-right: 0 !important; padding-left: 3rem    !important; }

html[dir="ltr"] .pl-1  { padding-left: 0 !important; padding-right: 0.25rem !important; }
html[dir="ltr"] .pl-2  { padding-left: 0 !important; padding-right: 0.5rem  !important; }
html[dir="ltr"] .pl-3  { padding-left: 0 !important; padding-right: 0.75rem !important; }
html[dir="ltr"] .pl-4  { padding-left: 0 !important; padding-right: 1rem    !important; }
html[dir="ltr"] .pl-6  { padding-left: 0 !important; padding-right: 1.5rem  !important; }
html[dir="ltr"] .pl-8  { padding-left: 0 !important; padding-right: 2rem    !important; }
html[dir="ltr"] .pl-10 { padding-left: 0 !important; padding-right: 2.5rem  !important; }
html[dir="ltr"] .pl-12 { padding-left: 0 !important; padding-right: 3rem    !important; }

/* Margin side flips (mr-* ↔ ml-*) */
html[dir="ltr"] .mr-1  { margin-right: 0 !important; margin-left: 0.25rem !important; }
html[dir="ltr"] .mr-2  { margin-right: 0 !important; margin-left: 0.5rem  !important; }
html[dir="ltr"] .mr-3  { margin-right: 0 !important; margin-left: 0.75rem !important; }
html[dir="ltr"] .mr-4  { margin-right: 0 !important; margin-left: 1rem    !important; }
html[dir="ltr"] .mr-6  { margin-right: 0 !important; margin-left: 1.5rem  !important; }
html[dir="ltr"] .mr-8  { margin-right: 0 !important; margin-left: 2rem    !important; }
html[dir="ltr"] .mr-10 { margin-right: 0 !important; margin-left: 2.5rem  !important; }
html[dir="ltr"] .mr-12 { margin-right: 0 !important; margin-left: 3rem    !important; }

html[dir="ltr"] .ml-1  { margin-left: 0 !important; margin-right: 0.25rem !important; }
html[dir="ltr"] .ml-2  { margin-left: 0 !important; margin-right: 0.5rem  !important; }
html[dir="ltr"] .ml-3  { margin-left: 0 !important; margin-right: 0.75rem !important; }
html[dir="ltr"] .ml-4  { margin-left: 0 !important; margin-right: 1rem    !important; }
html[dir="ltr"] .ml-6  { margin-left: 0 !important; margin-right: 1.5rem  !important; }
html[dir="ltr"] .ml-8  { margin-left: 0 !important; margin-right: 2rem    !important; }
html[dir="ltr"] .ml-10 { margin-left: 0 !important; margin-right: 2.5rem  !important; }
html[dir="ltr"] .ml-12 { margin-left: 0 !important; margin-right: 3rem    !important; }

/* הערה: לא מהפכים אוטומטית `left-*` / `right-*` של מיקום אבסולוטי —
   מיקומי badge/icon רגילים (cart counter ב-`top-right`) צריכים להישאר זהים
   בעברית ובאנגלית. אם נדרשת התאמה ספציפית, יש להוסיף כלל ייעודי. */

/* space-x-reverse: ב-LTR לבטל את ה-reverse כדי שמרווחים יוצגו בכיוון נכון */
html[dir="ltr"] .space-x-reverse > :not([hidden]) ~ :not([hidden]) {
    --tw-space-x-reverse: 0;
}

/* ה-Search button בהדר ממוקם אבסולוטית ב-`left-3` — מצמיד את האייקון
   לפיזי-שמאל. ב-LTR זה חופף לטקסט שמתחיל משמאל. נעביר ל-end. */
html[dir="ltr"] #header form[role="search"] button[type="submit"] {
    left: auto !important;
    right: 0.75rem !important;
}

/* Forward/back chevron + arrow icons — להפוך אופקית ב-LTR.
   בעברית הצביעו "קדימה" שמאלה; ב-LTR נדרש כיוון הפוך. */
html[dir="ltr"] i.fa-arrow-left,
html[dir="ltr"] i.fa-arrow-right,
html[dir="ltr"] i.fa-chevron-left,
html[dir="ltr"] i.fa-chevron-right {
    display: inline-block;
    transform: scaleX(-1);
}
