/* עיצוב בלוק Post Hero Banner */

/* סגנונות בסיסיים לבלוק - מוחל רק על סגנון Hero */
.banner-style-hero.post-hero-banner {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow: visible; /* שינוי מ-hidden ל-visible כדי לאפשר גלישת כותרת */
    padding-bottom: 0; /* יוגדר דינמית על ידי JavaScript */
    transition: padding-bottom 0.3s ease; /* אנימציה חלקה בעת שינוי הגובה */
}

/* ================================
   סגנון קלאסי - כותרת ותמונה מתחת
   ================================ */
.banner-style-classic {
    width: 100%;
    margin: 0 auto;
}

.post-hero-classic-wrapper {
    width: 100%;
}

/* הוסף את זה: */
.wp-block-ttfchild-post-hero-banner.banner-style-classic {
    padding-bottom: 30px !important; /* או כל ערך שמתאים לך */
}

.post-hero-classic-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 25px 20px 20px;
}

/* במצב קלאסי - הכותרות והמחבר */
.banner-style-classic .post-hero-banner-category {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--primary-color-jhhd, #1a1a1a) !important;
    border-radius: 20px;
    background: var(--secondary-color-jhhd-bright, #f5f5f5);
    color: var(--primary-color-jhhd, #1a1a1a) !important;
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 12px;
    line-height: 1.2;
    letter-spacing: 0.5px;
    text-decoration: none !important;
    transition: all 0.3s ease;
    cursor: pointer;
}

.banner-style-classic .post-hero-banner-category:hover {
    background: var(--primary-color-jhhd, #1a1a1a) !important;
    color: #ffffff !important;
    border: 1px solid var(--primary-color-jhhd, #1a1a1a) !important;
}

.banner-style-classic .post-hero-banner-title {
    margin: 0 0 15px 0;
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    color: #1a1a1a;
    letter-spacing: -0.5px;
}

.banner-style-classic .post-hero-banner-subtitle {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;
    color: #555;
}

/* התמונה בסגנון קלאסי */
.post-hero-classic-image-wrapper {
    max-width: 800px;
    margin: 0px auto 0;
    padding: 0 20px;
}

.post-hero-classic-image {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 8px;
}

/* חלק המחבר בסגנון קלאסי */
.banner-style-classic .post-hero-author-section {
    margin-top: 20px;
    padding: 15px 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* התאמות למסכים קטנים - סגנון קלאסי */
@media (max-width: 1024px) {
    .banner-style-classic .post-hero-banner-title {
        font-size: 36px;
    }
    
    .banner-style-classic .post-hero-banner-subtitle {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .post-hero-classic-content {
        padding: 25px 15px 20px;
    }
    
    .post-hero-classic-image-wrapper {
        padding: 0 15px;
    }
    
    .banner-style-classic .post-hero-banner-title {
        font-size: 28px;
    }
    
    .banner-style-classic .post-hero-banner-subtitle {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .banner-style-classic .post-hero-banner-title {
        font-size: 24px;
    }
    
    .banner-style-classic .post-hero-banner-subtitle {
        font-size: 14px;
    }
}

/* ================================
   סגנון Hero - הסגנון המקורי
   ================================ */

/* רק בדסקטופ - הרחבה לרוחב מלא */
@media (min-width: 1025px) {
    /* וידוא שגם ה-wrapper מתפרס לרוחב מלא */
    .banner-style-hero .post-hero-banner-wrapper {
        width: 100%;
    }
}

/* הורה הבלוק של גוטנברג – הבטחת זרימה מעל קטעים הבאים והימנעות מחיתוך במובייל */
.wp-block-ttfchild-post-hero-banner {
    position: relative;
    overflow: visible !important;
    z-index: 1; /* שומר שהטקסט שגולש יופיע מעל התוכן שאחריו */
    width: 100%; /* הבטחת רוחב מלא */
    margin: 0 auto; /* מרכוז הבלוק */
    min-height: 300px; /* גובה מינימלי כ-fallback */
    padding-bottom: 150px; /* padding בסיסי שיוחלף על ידי JavaScript */
}

/* עוטף פנימי – מונע חיתוך ותומך בשכבות נכונות */
.post-hero-banner-wrapper {
    position: relative;
    overflow: visible;
    z-index: 1;
}

/* בעורך - שמור על רוחב רגיל */
.post-hero-banner-editor {
    position: relative;
    width: 100%;
    margin: 0 auto;
    overflow: visible;
    padding-bottom: 80px; /* מבטיח מרווח מתחת לקופסת התמונה עבור הטקסט הגולש */
}

/* Wrapper for the banner - Hero style */
.banner-style-hero .post-hero-banner-wrapper {
    position: relative;
    width: 100%;
    overflow: visible; /* מאפשר למיכל התוכן לצאת החוצה */
}

/* תמונת רקע - יחס 19:6 - Hero style */
.banner-style-hero .post-hero-banner-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden; /* חזרה ל-hidden עבור התמונה בלבד */
    background: #f0f0f0;
    margin: 0 auto;
    /* padding-top מוגדר inline ב-PHP עם 31.58% */
}

.banner-style-hero .post-hero-banner-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Placeholder כשאין תמונה - Hero style */
.banner-style-hero .post-hero-banner-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.banner-style-hero .post-hero-banner-placeholder .placeholder-message {
    color: white;
    font-size: 18px;
    text-align: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
}

/* מיכל התוכן - ממורכז עם רוחב קבוע - Hero style */
.banner-style-hero .post-hero-banner-content {
    position: absolute;
    /* 60% מהתמונה חשופים, 40% מכוסים: 31.58% * 0.4 = 12.63vw */
    top: calc(100% - 12.63vw);
    left: 50%;
    transform: translateX(-50%);
    max-width: 880px;
    width: calc(100% - 40px);
    z-index: 10;
    padding: 0 20px;
    box-sizing: border-box;
    display: block;
    direction: rtl; /* וידוא כיוון RTL */
}

/* בדסקטופ גדול נמרכז ונגביל רוחב */
@media (min-width: 1025px) {
    .banner-style-hero .post-hero-banner-content {
        padding: 0 20px;
        /* במסכים גדולים, הגבלת המיקום למקסימום 170px */
        top: calc(100% - min(12.63vw, 170px));
    }
}

/* במסכים גדולים מאוד - הגבלת המרווח */
@media (min-width: 1400px) {
    .banner-style-hero .post-hero-banner-content {
        top: calc(100% - 170px); /* ערך קבוע במסכים גדולים מאוד */
        padding: 0 20px;
    }
}

.banner-style-hero .post-hero-banner-inner {
    background: #ffffff; /* התאמה מדויקת לרקע העמוד */
    padding: 30px 40px;
    border-radius: 8px;
    box-shadow: none; /* ללא צל כדי להתמזג עם הרקע */
    max-height: none; /* מאפשר גובה חופשי */
    overflow: visible; /* מאפשר גלישת תוכן */
    pointer-events: auto; /* מאפשר לחיצות על התוכן */
    width: 100%; /* רוחב מלא של התוכן הפנימי */
    box-sizing: border-box;
    text-align: right; /* יישור טקסט לימין בעברית */
}

/* תגית קטגוריה - Hero style */
.banner-style-hero .post-hero-banner-category {
    display: inline-block;
    padding: 4px 12px;
    border: 1px solid var(--primary-color-jhhd, #1a1a1a) !important;
    border-radius: 20px;
    background: var(--secondary-color-jhhd-bright, #f5f5f5);
    color: var(--primary-color-jhhd, #1a1a1a) !important;
    font-size: 14px;
    font-weight: 400;
    margin-bottom: 12px;
    line-height: 1.2;
    letter-spacing: 0.5px;
    text-decoration: none !important;
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: auto; /* מאפשר לחיצות */
    box-sizing: border-box;
}

/* תגית קטגוריה בהובר - Hero style */
.banner-style-hero .post-hero-banner-category:hover,
.banner-style-hero a.post-hero-banner-category:hover {
    background: var(--primary-color-jhhd, #1a1a1a) !important;
    color: #ffffff !important; /* טקסט לבן בהובר */
    border: 1px solid var(--primary-color-jhhd, #1a1a1a) !important;
    text-decoration: none !important;
}

/* וידוא שהצבע הלבן מוחל גם על קישורים */
.banner-style-hero .post-hero-banner-inner a.post-hero-banner-category:hover {
    color: #ffffff !important;
}

/* ביטול קו תחתון גם עבור קישורים שביקרו בהם */
.banner-style-hero .post-hero-banner-category:visited {
    text-decoration: none !important;
    color: var(--primary-color-jhhd, #1a1a1a) !important;
}

/* כותרת ראשית - Hero style */
.banner-style-hero .post-hero-banner-title {
    margin: 0 0 15px 0;
    font-size: 42px;
    font-weight: 700;
    line-height: 1.2;
    color: #1a1a1a; /* טקסט כהה על רקע לבן */
    letter-spacing: -0.5px;
}

/* כותרת משנה - Hero style */
.banner-style-hero .post-hero-banner-subtitle {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.6;
    color: #555; /* אפור כהה על רקע לבן */
}

/* עיצובים למסכים קטנים - Hero style */
@media (max-width: 1024px) {
    .banner-style-hero .post-hero-banner-content {
        top: calc(100% - 12.63vw); /* 40% מגובה התמונה */
        max-width: 700px; /* רוחב מקסימלי קצת יותר קטן במסכים בינוניים */
    }
    
    .post-hero-banner-editor {
        padding-bottom: 100px; /* בעורך: הגדלת הריווח במסכים בינוניים */
    }
    /* במסכים בינוניים התוכן כבר מלא */
    
    .banner-style-hero .post-hero-banner-inner {
        padding: 25px 30px;
    }
    
    .banner-style-hero .post-hero-banner-title {
        font-size: 36px;
    }
    
    .banner-style-hero .post-hero-banner-subtitle {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .post-hero-banner-editor {
        padding-bottom: 120px; /* בעורך: ריווח גדול יותר למובייל */
    }
    
    .banner-style-hero .post-hero-banner-content {
        top: calc(100% - 10vw); /* מרווח קטן יותר במובייל */
        max-width: 90%; /* במובייל מגבילים ל-90% מהרוחב */
        width: calc(100% - 30px);
        padding: 0 15px;
    }
    
    /* ביטול ההגדרות מ-post-author-selector שמגבילות ל-50% */
    .post-hero-banner .author-name-wrapper,
    .post-hero-banner-inner .author-name-wrapper {
        max-width: none !important;
        max-width: 100% !important;
        display: grid !important; /* לא contents */
    }
    
    .post-hero-banner .post-date-wrapper,
    .post-hero-banner-inner .post-date-wrapper,
    .post-hero-banner .post-date,
    .post-hero-banner-inner .post-date {
        max-width: none !important;
        max-width: auto !important;
        display: flex !important; /* לא contents */
        overflow-x: visible !important;
    }
    
    /* במובייל יש לעתים חיתוך ברמת הורה – נכפה חשיפה מלאה */
    .wp-block-ttfchild-post-hero-banner,
    .post-hero-banner,
    .post-hero-banner-wrapper,
    .post-hero-banner-image-wrapper {
        overflow: visible !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .banner-style-hero .post-hero-banner-inner {
        padding: 20px;
    }
    
    .banner-style-hero .post-hero-banner-title {
        font-size: 28px;
    }
    
    .banner-style-hero .post-hero-banner-subtitle {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .post-hero-banner-editor {
        padding-bottom: 140px; /* בעורך: ריווח נוסף למסכים קטנים מאוד */
    }
    
    .banner-style-hero .post-hero-banner-content {
        top: calc(100% - 8vw); /* מרווח קטן יותר במסכים קטנים מאוד */
        max-width: 95%;
        width: calc(100% - 20px);
        padding: 0 10px;
    }
    
    .banner-style-hero .post-hero-banner-title {
        font-size: 24px;
    }
    
    .banner-style-hero .post-hero-banner-subtitle {
        font-size: 14px;
    }
    
    .banner-style-hero .post-hero-banner-inner {
        padding: 15px;
    }
}

/* תמיכה ב-align wide ו-full */
.wp-block-ttfchild-post-hero-banner.alignfull {
    width: 100vw !important;
    position: relative !important;
    left: 50% !important;
    right: 50% !important;
    margin-left: -50vw !important;
    margin-right: -50vw !important;
    max-width: none !important;
}

/* וידוא שהמיכל נשאר ממורכז גם ב-alignfull */
.wp-block-ttfchild-post-hero-banner.alignfull .post-hero-banner-content {
    left: 50%;
    transform: translateX(-50%);
}

.wp-block-ttfchild-post-hero-banner.alignwide,
.post-hero-banner.alignwide {
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

/* עיצובים לעורך גוטנברג */
.post-hero-banner-editor .post-hero-banner-title[contenteditable="true"]:empty:before {
    content: attr(aria-placeholder);
    opacity: 0.62;
    pointer-events: none;
}

.post-hero-banner-editor .post-hero-banner-subtitle[contenteditable="true"]:empty:before {
    content: attr(aria-placeholder);
    opacity: 0.62;
    pointer-events: none;
}

.post-hero-banner-editor .post-hero-banner-inner {
    pointer-events: all;
}

/* הודעת placeholder בעורך */
.post-hero-banner-placeholder-message {
    padding: 20px;
    background: #f8f8f8;
    border: 2px dashed #ddd;
    text-align: center;
    color: #666;
    margin: 20px 0;
    border-radius: 4px;
}

/* ================================
   חלק המחבר והתאריך בתוך הבלוק
   ================================ */

/* מיכל המחבר בתוך בלוק ה-hero */
.post-hero-author-section {
    margin-top: 20px;
    padding: 15px 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 12px;
}

/* תמונת הפרופיל */
.post-hero-author-section .author-avatar {
    flex-shrink: 0;
}

.post-hero-author-section .author-avatar img {
    border-radius: 50%;
    display: block;
}

/* מיכל פרטי המחבר */
.post-hero-author-section .author-info {
    flex: 1;
    min-width: 0;
}

/* שורת המטא (שם מחבר ותאריך) */
.post-hero-author-section .author-meta-line {
    display: flex;
    width: 100%;
}

/* עטיפת שם המחבר - מכיל את כל האלמנטים */
.post-hero-author-section .author-name-wrapper {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
}

/* כאשר יש ביוגרפיה - בדסקטופ */
.post-hero-author-section .author-name-wrapper.has-author-bio {
    flex-direction: row;
}

/* התאריך בדסקטופ - מיושר לימין */
.post-hero-author-section .author-name-wrapper .post-date-wrapper {
    margin-right: auto;
    flex: 0 0 auto;
}

/* כאשר אין ביוגרפיה - בדסקטופ */
.post-hero-author-section .author-name-wrapper.no-author-bio {
    flex-direction: row;
}

/* שם המחבר */
.post-hero-author-section .author-name {
    font-size: 14px;
    font-weight: 400;
    color: #1a1a1a;
    white-space: nowrap;
    display: inline-block;
    text-decoration: none !important; /* ביטול קו תחתון */
    transition: color 0.3s ease;
    cursor: pointer;
    pointer-events: auto; /* מאפשר לחיצות */
    border: none;
    outline: none;
}

/* שם המחבר בהובר */
.post-hero-author-section .author-name:hover {
    color: var(--secondary-color-jhhd, #007cba);
    text-decoration: none !important; /* ביטול קו תחתון גם בהובר */
}

/* ביטול קו תחתון גם עבור קישורים שביקרו בהם */
.post-hero-author-section .author-name:visited {
    text-decoration: none !important;
}

/* ביוגרפיה של המחבר - בדסקטופ מוצגת בשורה */
.post-hero-author-section .author-bio {
    font-size: 13px;
    font-weight: 300;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 300px;
    display: inline-block;
}

/* הוספת מקף לפני הביוגרפיה בדסקטופ */
.post-hero-author-section .author-bio::before {
    content: ' - ';
    color: #999;
}

/* התאריך */
.post-hero-author-section .post-date {
    font-size: 14px;
    color: #666;
    white-space: nowrap;
}

/* עיצובים למסכים קטנים עבור חלק המחבר */
@media (max-width: 768px) {
    .post-hero-author-section {
        flex-direction: row;
        align-items: flex-start;
        gap: 10px;
    }
    
    .post-hero-author-section .author-info {
        width: 100%;
    }
    
    .post-hero-author-section .author-meta-line {
        display: flex;
        flex-direction: column;
        gap: 0;
        width: 100%;
    }
    
    /* מיכל לכל האלמנטים */
    .post-hero-author-section .author-name-wrapper {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start; /* התחלה מימין ב-RTL */
        align-items: flex-start;
        width: 100%;
        gap: 0;
        min-height: 35px; /* גובה מינימלי לשורה הראשונה */
    }
    
    /* כאשר יש ביוגרפיה - עיצוב מיוחד */
    .post-hero-author-section .author-name-wrapper.has-author-bio {
        display: grid !important;
        grid-template-columns: 1fr auto !important; /* עמודה ימנית גמישה, עמודה שמאלית לתאריך */
        grid-template-rows: auto auto !important;
        gap: 4px 15px !important; /* רווח בין שורות ועמודות */
        align-items: stretch !important; /* מאפשר לפריטים למתוח לגובה מלא */
        max-width: 100% !important; /* ביטול ה-50% */
        width: 100% !important;
        position: relative !important;
    }
    
    .post-hero-author-section .author-name-wrapper.has-author-bio .author-name {
        grid-column: 1;
        grid-row: 1;
        align-self: start; /* יישור לתחילת התא */
    }
    
    .post-hero-author-section .author-name-wrapper.has-author-bio .post-date-wrapper {
        grid-column: 2;
        grid-row: 1 / span 2; /* תופס את שתי השורות */
        display: flex !important;
        align-items: center !important; /* מרכז אנכי */
        justify-content: flex-start !important; /* יישור לשמאל בתוך העמודה */
        align-self: stretch !important; /* מתיחה לכל גובה השורות */
        min-height: 100% !important; /* גובה מינימלי מלא */
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .post-hero-author-section .author-name-wrapper.has-author-bio .author-bio {
        grid-column: 1;
        grid-row: 2;
        align-self: start; /* יישור לתחילת התא */
    }
    
    /* כאשר אין ביוגרפיה - שורה אחת */
    .post-hero-author-section .author-name-wrapper.no-author-bio {
        display: grid !important;
        grid-template-columns: 1fr auto !important; /* עמודה ימנית לשם, עמודה שמאלית לתאריך */
        gap: 15px !important;
        align-items: center !important; /* מרכז אנכי */
        max-width: 100% !important; /* ביטול ה-50% */
        width: 100% !important;
    }
    
    .post-hero-author-section .author-name-wrapper.no-author-bio .author-name {
        grid-column: 1;
        text-align: right; /* יישור לימין */
    }
    
    .post-hero-author-section .author-name-wrapper.no-author-bio .post-date-wrapper {
        grid-column: 2;
        display: flex;
        align-items: center;
        justify-content: flex-start; /* יישור לשמאל בתוך העמודה */
    }
    
    .post-hero-author-section .author-name {
        font-size: 13px;
        line-height: 1.2;
        display: inline-block !important; /* לא contents */
        white-space: nowrap;
    }
    
    .post-hero-author-section .author-bio {
        display: block;
        font-size: 12px;
        font-weight: 300;
        color: #666;
        line-height: 1.3;
        white-space: normal;
        max-width: none;
        overflow: visible;
        text-overflow: clip;
        width: 100%;
    }
    
    /* הסרת המקף במובייל כי הביוגרפיה בשורה נפרדת */
    .post-hero-author-section .author-bio::before {
        content: '';
        display: none;
    }
    
    .post-hero-author-section .post-date {
        font-size: 13px;
        white-space: nowrap;
        display: inline-block !important; /* לא contents */
        text-align: left;
        max-width: none !important; /* ביטול ה-50% */
        overflow: visible !important;
    }
    
    .post-hero-author-section .post-date-wrapper {
        padding: 0;
        margin: 0;
        max-width: none !important; /* ביטול ה-50% */
        display: flex !important; /* לא contents */
        overflow: visible !important;
    }
}

@media (max-width: 480px) {
    .post-hero-author-section .author-name {
        font-size: 12px;
    }
    
    .post-hero-author-section .author-bio {
        font-size: 11px;
        line-height: 1.3;
    }
    
    .post-hero-author-section .post-date {
        font-size: 12px;
    }
    
    /* התאמת הגריד למסכים קטנים */
    .post-hero-author-section .author-name-wrapper.has-author-bio {
        gap: 4px 10px; /* רווח קטן יותר במסכים קטנים */
    }
}
