/* ==========================================================================
   install-prompt.css — ההזמנה להוסיף את בית המטפלים למסך הבית
   נבנה 2026-08-27 · הותאם למותג בית המטפלים 2026-08-29

   שני רכיבים, שני מסלולים שונים לגמרי:
     · .ip-banner  — פס תחתון לאנדרואיד/כרום. שם יש כפתור אמיתי שמפעיל
                     את חלון ההוספה של הדפדפן.
     · .ip-overlay — גיליון הסבר לאייפון/ספארי. שם אין שום כפתור תכנותי,
                     ולכן הרכיב הזה **מסביר** במקום לבצע.

   שפת המותג (css/theme.css):
     · פטרול עמוק #003B46 כמשטח, זהב #D4AF37 כאקסנט, פרוסט-וייט #E8F1F2
       כטקסט. זה בדיוק הצירוף שהפורטל משתמש בו בסיידבר ובניווט.
     · פינות מעוגלות 10px, כמו --t-btn-radius בטוקנים של הפרויקט.
     · הכפתור הראשי: זהב על פטרול, טקסט פטרול על הזהב. ~9.4:1 — עובר AA.
     · פונטים: Heebo לגוף, Frank Ruhl Libre לכותרות. ערכי ה-var נשארים
       כברירת מחדל כדי לרשת את הטוקנים כשהם קיימים בעמוד.
     · הטקסט הבהיר מילולי (#E8F1F2) ולא דרך טוקן — כדי שמצב כהה/בהיר
       של הפורטל לא ידרוס אותו למשהו בלתי קריא על הפטרול.

   נטען ע"י js/install-prompt.js אם אין בעמוד <link> אליו.
   ========================================================================== */

/* ── משתני הרכיב. מרוכזים כאן כדי שהתחזוקה תהיה בשורה אחת ─────────────── */
.ip-banner,
.ip-overlay {
    --ip-surface: #003B46;
    --ip-surface-2: #00606B;
    --ip-text: #E8F1F2;
    --ip-text-muted: rgba(232, 241, 242, 0.74);
    --ip-accent: #D4AF37;
    --ip-on-accent: #003B46;
    --ip-hairline: rgba(232, 241, 242, 0.18);
    --ip-radius: 10px;
    font-family: var(--t-font-body, 'Heebo', sans-serif);
    direction: rtl;
    text-align: right;
    box-sizing: border-box;
}

.ip-banner *,
.ip-overlay * { box-sizing: border-box; }

/* ==========================================================================
   1. הפס התחתון — אנדרואיד / כרום
   ========================================================================== */

/* z-index 8500: מתחת למנוע הפופ-אפים (9000) בכוונה. אם פופ-אפ פתוח,
   הוא הבעלים של המסך וההזמנה הזאת מחכה בתור. */
.ip-banner {
    position: fixed;
    inset-block-end: 0;
    inset-inline: 0;
    z-index: 8500;
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
    background: var(--ip-surface);
    color: var(--ip-text);
    border-top: 3px solid var(--ip-accent);
    border-radius: var(--ip-radius) var(--ip-radius) 0 0;
    box-shadow: 0 -12px 40px rgba(0, 59, 70, 0.45);
    /* מגרעת האייפון ופס הניווט של אנדרואיד. בלי זה הכפתור נחתך למטה. */
    padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateY(110%);
    transition: transform 240ms ease;
}

.ip-banner.is-open { transform: translateY(0); }

/* שורת התוכן. flex ולא grid — grid-template-columns: 1fr לבד קורס במובייל. */
.ip-banner-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    /* מפנה מקום לכפתור ה-X שיושב בפינה הפתוחה (שמאל למעלה ב-RTL),
       אחרת הכותרת נכנסת מתחתיו. */
    padding-inline-start: 44px;
}

.ip-banner-glyph {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ip-accent);
}

.ip-banner-glyph svg { width: 100%; height: 100%; display: block; }

/* min-width: 0 מכריח את הטקסט להישבר בתוך ה-flex במקום למתוח את הפס */
.ip-banner-text { min-width: 0; }

.ip-banner-title {
    display: block;
    font-family: var(--t-font-display, 'Frank Ruhl Libre', serif);
    font-weight: 900;
    font-size: 1.06rem;
    line-height: 1.25;
    color: var(--ip-text);
    margin-bottom: 4px;
    overflow-wrap: anywhere;
}

.ip-banner-sub {
    display: block;
    font-size: 0.88rem;
    line-height: 1.5;
    color: var(--ip-text-muted);
    overflow-wrap: anywhere;
}

.ip-banner-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 14px;
}

/* ==========================================================================
   2. כפתורים משותפים
   ========================================================================== */
.ip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    /* 44px = יעד המגע המינימלי. גם כשהטקסט קצר. */
    min-height: 46px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--ip-radius);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}

/* זהב על פטרול. אותה זהות של הכפתור הראשי ב-theme.css, עם טקסט
   פטרול על הזהב — הצירוף הקריא ביותר של המותג. */
.ip-btn-primary {
    flex: 1 1 auto;
    min-width: 0;
    background: var(--ip-accent);
    color: var(--ip-on-accent);
    font-family: var(--t-font-display, 'Frank Ruhl Libre', serif);
    font-weight: 900;
    font-size: 1.02rem;
    transition: transform 100ms ease, filter 200ms ease;
}

.ip-btn-primary:hover { filter: brightness(0.94); color: var(--ip-on-accent); }
.ip-btn-primary:active { transform: scale(0.98); }

.ip-btn-ghost {
    flex: 0 0 auto;
    background: none;
    color: var(--ip-text-muted);
    text-decoration: underline;
    font-weight: 400;
    padding-inline: 8px;
}

.ip-btn-ghost:hover { color: var(--ip-text); }

/* סימון פוקוס. על משטח הפטרול רק הזהב נראה — מסגרת כהה נבלעת. */
.ip-btn:focus-visible,
.ip-close:focus-visible,
.ip-banner-close:focus-visible {
    outline: 3px solid var(--ip-accent);
    outline-offset: 2px;
}

/* ==========================================================================
   3. כפתורי הסגירה — 44px גם כשהסימן עצמו קטן
   ========================================================================== */
.ip-banner-close,
.ip-close {
    position: absolute;
    inset-block-start: 6px;
    inset-inline-start: 6px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.6rem;
    line-height: 1;
    color: var(--ip-text-muted);
    cursor: pointer;
}

.ip-banner-close:hover,
.ip-close:hover { color: var(--ip-text); }

/* ==========================================================================
   3ב. קישור "רואים כאן" — בשני המסלולים, ונגן הסרטון שהוא פותח
   נוסף 2026-08-30. אין כפתור אם אין מקור סרטון למכשיר (videoSrc() ב-JS
   מחזיר ריק) — עדיף היעדר קישור מקישור מת.
   ========================================================================== */
.ip-banner-watch,
.ip-sheet-watch {
    display: flex;
    justify-content: center;
}

.ip-banner-watch:empty,
.ip-sheet-watch:empty { display: none; }

.ip-banner-watch { margin-top: 10px; }
.ip-sheet-watch { margin-top: 14px; }

.ip-watch-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 8px 4px;
    /* יעד מגע: הגובה נמוך מ-44 בכוונה כי זו פעולה משנית, לא ראשית —
       אבל הרוחב האפקטיבי כולל את הריפוד וה-gap מספיק לנגיעה נוחה. */
    min-height: 32px;
    color: var(--ip-text-muted);
    font-family: inherit;
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.ip-watch-link:hover { color: var(--ip-text); }

.ip-watch-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    color: var(--ip-accent);
}

.ip-watch-icon svg { width: 100%; height: 100%; display: block; }

/* ==========================================================================
   4. גיליון ההסבר — אייפון / ספארי
   ========================================================================== */
.ip-overlay {
    position: fixed;
    inset: 0;
    z-index: 8600;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: rgba(0, 30, 36, 0.62);
    opacity: 0;
    transition: opacity 180ms ease;
}

.ip-overlay.is-open { opacity: 1; }

.ip-sheet {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: var(--ip-surface);
    color: var(--ip-text);
    border-top: 4px solid var(--ip-accent);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 59, 70, 0.42);
    padding: 20px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    transform: translateY(18px);
    transition: transform 200ms ease;
    max-height: 88vh;
    overflow-y: auto;
}

.ip-overlay.is-open .ip-sheet { transform: translateY(0); }

.ip-grip {
    width: 44px;
    height: 4px;
    border-radius: 2px;
    background: rgba(232, 241, 242, 0.26);
    margin: 0 auto 16px;
}

.ip-title {
    margin: 0 0 8px 0;
    padding-inline-start: 44px;   /* לא נכנס מתחת ל-X */
    font-family: var(--t-font-display, 'Frank Ruhl Libre', serif);
    font-weight: 900;
    font-size: 1.2rem;
    line-height: 1.28;
    color: var(--ip-text);
    overflow-wrap: anywhere;
}

.ip-lead {
    margin: 0 0 18px 0;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--ip-text-muted);
    overflow-wrap: anywhere;
}

/* ── שני הצעדים ─────────────────────────────────────────────────────────── */
.ip-steps {
    list-style: none;
    margin: 0 0 16px 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ip-step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

/* ריבוע מספור בזהב. זה בדיוק התפקיד שהמותג מייעד לזהב על פטרול. */
.ip-step-num {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ip-accent);
    color: var(--ip-on-accent);
    border-radius: 6px;
    font-weight: 800;
    font-size: 0.92rem;
    line-height: 1;
}

.ip-step-text {
    min-width: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--ip-text);
    overflow-wrap: anywhere;
}

/* אייקון השיתוף של iOS, משובץ בתוך שורת הטקסט */
.ip-share-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    margin: 0 4px;
    vertical-align: -9px;
    background: rgba(232, 241, 242, 0.10);
    border: 1px solid var(--ip-hairline);
    color: var(--ip-accent);
}

.ip-share-inline svg { width: 17px; height: 17px; display: block; }

/* ציטוט של הכיתוב שהמאזין מחפש בתפריט של ספארי */
.ip-quote {
    display: inline-block;
    padding: 2px 7px;
    background: rgba(232, 241, 242, 0.10);
    border: 1px solid var(--ip-hairline);
    font-weight: 700;
    white-space: nowrap;
}

.ip-note {
    margin: 0;
    padding-top: 14px;
    border-top: 1px solid var(--ip-hairline);
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--ip-text-muted);
}

.ip-sheet-actions {
    display: flex;
    margin-top: 18px;
}

.ip-sheet-actions .ip-btn { width: 100%; }

/* ==========================================================================
   4ב. נגן הסרטון — נפתח לפעמים **מעל** גיליון האייפון (z-index זהה,
   מאוחר יותר ב-DOM ולכן מצויר מעליו). הבלוק הזה רק מצמצם את הריפוד
   הרגיל של .ip-sheet כדי שהווידאו יתפוס את רוב הגובה, לא מגדיר סוג חדש.
   ========================================================================== */
.ip-video-sheet {
    padding-inline: 12px;
    padding-block-end: calc(12px + env(safe-area-inset-bottom, 0px));
}

.ip-video-title {
    padding-inline-start: 44px;
    margin-bottom: 12px;
}

.ip-video-wrap {
    /* 9:16 — הסרטונים אנכיים (מסך טלפון). למסך רחב הגובה מוגבל כדי שלא
       ידחוף את הדיאלוג מעבר לגובה הנראה. */
    aspect-ratio: 9 / 16;
    max-height: 70vh;
    margin: 0 auto;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.ip-video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

/* ==========================================================================
   5. מסכים רחבים — הגיליון הופך לכרטיס ממורכז, הפס מתקצר
   ========================================================================== */
@media (min-width: 481px) {
    .ip-overlay {
        align-items: center;
        padding: 24px;
    }

    .ip-sheet {
        max-width: 420px;
        padding: 26px 26px 24px;
        transform: translateY(0) scale(0.97);
    }

    .ip-overlay.is-open .ip-sheet { transform: translateY(0) scale(1); }

    .ip-grip { display: none; }

    .ip-banner {
        inset-block-end: 18px;
        inset-inline-end: 18px;
        inset-inline-start: auto;
        margin: 0;
        width: min(400px, calc(100vw - 36px));
        border: 1px solid var(--ip-hairline);
        border-top: 3px solid var(--ip-accent);
    }

    .ip-banner:not(.is-open) { transform: translateY(140%); }
}

/* ==========================================================================
   6. מסכים צרים במיוחד (360px ומטה) — הכפתורים לא נחתכים
   ========================================================================== */
@media (max-width: 360px) {
    .ip-banner { padding: 14px 12px calc(14px + env(safe-area-inset-bottom, 0px)); }
    .ip-banner-row { padding-inline-start: 40px; gap: 10px; }
    .ip-banner-title { font-size: 1rem; }
    .ip-banner-sub { font-size: 0.84rem; }

    /* מתחת ל-360 אין מקום לשני כפתורים זה לצד זה בלי חיתוך.
       הראשי תופס שורה מלאה, ו"לא עכשיו" יורד מתחתיו ונשאר במרכז. */
    .ip-banner-actions { flex-direction: column; align-items: stretch; gap: 6px; }
    .ip-btn-primary { width: 100%; font-size: 0.98rem; }
    .ip-btn-ghost { width: 100%; }

    .ip-sheet { padding: 18px 14px calc(18px + env(safe-area-inset-bottom, 0px)); }
    .ip-title { font-size: 1.1rem; }
    .ip-step-text { font-size: 0.92rem; }
}

/* ==========================================================================
   7. העדפות מערכת
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .ip-banner,
    .ip-overlay,
    .ip-sheet,
    .ip-btn-primary { transition: none; }

    .ip-banner { transform: none; }
    .ip-banner:not(.is-open) { transform: none; display: none; }
    .ip-sheet { transform: none; }
    .ip-overlay.is-open .ip-sheet { transform: none; }
}

/* מצב ניגודיות גבוהה: מוסיפים מתאר לבן כדי שהמשטח לא ייבלע ברקע */
@media (prefers-contrast: more) {
    .ip-banner,
    .ip-sheet { border: 2px solid #E8F1F2; border-top: 3px solid var(--ip-accent); }
}

/* נעילת גלילת הרקע בזמן שהגיליון פתוח */
html.ip-locked,
body.ip-locked { overflow: hidden; }

/* ==========================================================================
   8. חגורת ביטחון — באפליקציה שכבר על מסך הבית לא מוצג כלום.
   ה-JS כבר לא מרנדר במצב הזה. זה הרובד השני, למקרה שקובץ ישן נשאר בקאש.
   ========================================================================== */
@media all and (display-mode: standalone) {
    .ip-banner,
    .ip-overlay { display: none !important; }
}

@media all and (display-mode: minimal-ui) {
    .ip-banner,
    .ip-overlay { display: none !important; }
}
