/* darashty.co.il - styles.css
 * בס"ד - סגנונות מאוחדים לאתר שיעורי הרב איתן כהן שליט"א
 * מבוסס על העיצוב המקורי של האתר, מותאם למבנה החדש
 */

/* ===== CSS Variables ===== */
:root {
    /* צבעים - שמורים מהאתר המקורי */
    --primary-color: #012E4A;
    --secondary-color: #036280;
    --header-color: #053959;
    --background-color: #E8EDE7;
    --text-color: #012E4A;
    --sidebar-bg: #F2F5F0;
    --transcript-bg: #F7F9F5;
    --hover-color: #81BECE;
    --accent-color: #475569;
    --focus-color: #0066cc;

    /* ===== משפחת צבעי מבטא חמים - לעיטורים זעירים בלבד ===== */
    --accent-warm: #8B3A4A;          /* יין-בורדו - לעיטורים */
    --accent-warm-dark: #7A2E3A;     /* יין כהה - לטקסט מודגש בעתיד */
    --accent-warm-light: #F4E6E9;    /* ורד עדין מאוד - לרקעי-משנה בעתיד */

    /* ===== וריאציה לזהות דפי העלונים ===== */
    --secondary-deep: #4682A3;       /* כחול-פלדה - לקוביות דף העלונים */

    /* מידות */
    --container-max: 1100px;
    --content-max: 800px;
    --border-radius: 12px;
    --header-padding: 20px;
    --section-spacing: 32px;

    /* צללים */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.16);

    /* מעברים */
    --transition: 0.25s ease;
}

/* ===== Reset ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== Base ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Assistant', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.65;
    direction: rtl;
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: var(--secondary-color);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover, a:focus {
    color: var(--hover-color);
}

a:focus-visible {
    outline: 2px solid var(--focus-color);
    outline-offset: 2px;
    border-radius: 4px;
}

ul, ol {
    list-style-type: none;
}

/* ===== Header ===== */
.site-header {
    background-color: var(--header-color);
    color: white;
    padding: var(--header-padding);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.site-header .header-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.logo-link {
    display: inline-block;
    border-radius: 50%;
    transition: transform var(--transition);
}

.logo-link:hover {
    transform: scale(1.05);
}

.logo-link img {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.site-title {
    font-family: 'Heebo', 'Assistant', sans-serif;
    font-size: clamp(1.3em, 2.5vw, 1.8em);
    font-weight: 700;
    margin: 0;
    color: white;
}

.site-subtitle {
    font-size: clamp(0.95em, 1.5vw, 1.05em);
    font-weight: 300;
    color: rgba(255,255,255,0.92);
    max-width: 700px;
    margin: 0 auto;
}

.header-nav {
    margin-top: 4px;
}

.header-nav ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px 14px;
}

.header-nav a {
    color: rgba(255,255,255,0.92);
    font-size: 0.95em;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background var(--transition);
}

.header-nav a:hover {
    background: rgba(255,255,255,0.15);
    color: white;
}

.header-nav .separator {
    color: rgba(255,255,255,0.4);
    user-select: none;
}

/* ===== Primary Navigation (כפתורי ניווט ראשיים) ===== */
.primary-nav {
    background: var(--transcript-bg);
    border-bottom: 1px solid rgba(1, 46, 74, 0.08);
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.primary-nav-inner {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 12px var(--header-padding);
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 20px;
    background: var(--background-color);
    color: var(--primary-color);
    border: 1px solid rgba(1, 46, 74, 0.12);
    border-radius: 8px;
    font-size: 0.98em;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
}

.nav-btn:hover, .nav-btn:focus-visible {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

@media (max-width: 560px) {
    .primary-nav-inner {
        padding: 10px 12px;
        gap: 8px;
    }
    .nav-btn {
        padding: 8px 14px;
        font-size: 0.92em;
        flex: 1 1 auto;
        justify-content: center;
    }
}

/* ===== Main Layout ===== */
main.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 24px var(--header-padding);
    flex: 1;
    width: 100%;
}

/* ===== Home Page (רשימת שיעורים) ===== */

/* קטע הקדמה בדף הבית - טקסט מקדים עם תמונת הרב */
.home-intro {
    background: white;
    border-radius: var(--border-radius);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 28px;
    display: flex;
    gap: 28px;
    align-items: center;
    border-top: 4px solid var(--secondary-color);
}

.home-intro-text {
    flex: 1;
    min-width: 0;
}

.home-intro-title {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: clamp(1.35em, 2.6vw, 1.7em);
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.3;
    margin-bottom: 16px;
}

.home-intro-text p {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 1.05em;
    line-height: 1.8;
    margin-bottom: 12px;
    color: var(--text-color);
    text-align: justify;
}

.home-intro-text p:last-child {
    margin-bottom: 0;
}

.home-intro-image {
    flex-shrink: 0;
}

.home-intro-image img {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--background-color);
    box-shadow: var(--shadow-md);
}

@media (max-width: 720px) {
    .home-intro {
        flex-direction: column-reverse;
        padding: 22px;
        gap: 18px;
    }
    .home-intro-text {
        text-align: center;
    }
    .home-intro-text p {
        text-align: right;
    }
    .home-intro-image img {
        width: 150px;
        height: 150px;
    }
}

/* קטע הקדמה בדף האינדקס של העלונים */
.pdf-index-intro p {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 1.05em;
    line-height: 1.8;
    color: var(--text-color);
    margin-bottom: 12px;
    text-align: justify;
}

.pdf-index-intro p:last-child {
    margin-bottom: 0;
}

.shiurim-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 18px;
    margin-top: 24px;
}

.shiur-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
    display: flex;
    flex-direction: column;
    gap: 8px;
    border-right: 4px solid var(--secondary-color);
    position: relative;
}

.shiur-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

/* ===== מסגרת פנימית עדינה ב-hover ===== */
.shiur-card::before {
    content: '';
    position: absolute;
    inset: 5px;
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}

.shiur-card:hover::before {
    opacity: 0.4;
}

.shiur-card .shiur-number {
    font-size: 0.85em;
    color: var(--accent-color);
    font-weight: 600;
}

.shiur-card .shiur-title {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 1.25em;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.3;
    margin: 4px 0;
}

.shiur-card .shiur-description {
    font-size: 0.95em;
    color: var(--accent-color);
    line-height: 1.5;
    flex: 1;
}

.shiur-card a {
    text-decoration: none;
    color: inherit;
    display: block;
}

.search-container {
    margin: 24px 0 8px;
}

.search-container input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(1, 46, 74, 0.15);
    border-radius: var(--border-radius);
    font-size: 1.05em;
    font-family: inherit;
    background: white;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-container input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(3, 98, 128, 0.15);
}

/* תוצאות חיפוש */
.search-result-count {
    margin-top: 8px;
    font-size: 0.92em;
    color: var(--accent-color);
    padding: 0 4px;
}

.search-snippet {
    margin-top: 10px;
    padding: 10px 12px;
    background: rgba(3, 98, 128, 0.06);
    border-right: 3px solid var(--secondary-color);
    border-radius: 6px;
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 0.92em;
    line-height: 1.5;
    color: var(--text-color);
}

.search-snippet mark {
    background: rgba(255, 235, 59, 0.5);
    color: inherit;
    font-weight: 600;
    padding: 0 2px;
    border-radius: 2px;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ===== Shiur Page ===== */
.shiur-page {
    max-width: var(--content-max);
    margin: 0 auto;
}

.breadcrumbs {
    margin-bottom: 16px;
    font-size: 0.92em;
    color: var(--accent-color);
}

.breadcrumbs a {
    color: var(--accent-color);
}

.shiur-header {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.shiur-header .shiur-meta {
    font-size: 0.9em;
    color: var(--accent-color);
    margin-bottom: 8px;
}

.shiur-header h1 {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: clamp(1.5em, 3.5vw, 2em);
    color: var(--primary-color);
    line-height: 1.25;
    margin-bottom: 10px;
}

.shiur-header .shiur-subtitle {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 1.5em;
    font-weight: 600;
    color: var(--secondary-color);
    margin: 0 0 16px;
    line-height: 1.4;
}

/* ===== עיטור עדין תחת כותרת ראשית ===== */
.title-ornament {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 14px auto 8px;
    max-width: 280px;
    opacity: 0.85;
}

.title-ornament-line {
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-warm), transparent);
}

.title-ornament-star {
    color: var(--accent-warm);
    font-size: 1.1em;
    line-height: 1;
    user-select: none;
}

/* מרכוז הכותרת והעיטור - יוצר התאמה ויזואלית עם העיטור הממורכז */
.shiur-header .shiur-meta,
.shiur-header h1,
.shiur-header .shiur-subtitle {
    text-align: center;
}

.shiur-header .shiur-actions {
    justify-content: center;
}

.shiur-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 0.95em;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--transcript-bg);
    color: var(--primary-color);
    border: 1px solid rgba(1, 46, 74, 0.15);
}

.btn-secondary:hover {
    background: var(--sidebar-bg);
    color: var(--primary-color);
}

/* ===== Shiur Highlights (רעיונות וסיפורים) =====
 * קטע המוצג בדף שיעור בין הכותרת למיכל הוידאו.
 * שני כרטיסים זה לצד זה: רעיונות מרכזיים + סיפורים בשיעור.
 * שימוש ב-flex (ולא grid) כדי להבטיח פריסה אופקית גם בקונטיינרים יחסית צרים.
 */
.shiur-highlights {
    margin-bottom: 24px;
}

.highlights-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    align-items: stretch;
}

.highlights-grid > .highlight-card {
    flex: 1 1 0;
    min-width: 0;
    box-sizing: border-box;
}

/* כשרק אחד מהקטעים קיים - יחזיק את הרוחב המלא */
.highlights-grid.highlights-single > .highlight-card {
    flex: 1 1 100%;
}

.highlight-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 18px 22px;
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--secondary-color);
    transition: box-shadow var(--transition);
}

.highlight-card:hover {
    box-shadow: var(--shadow-md);
}

.highlight-card.highlight-stories {
    border-top-color: var(--accent-color);
}

.highlight-title {
    font-family: 'Heebo', 'Assistant', sans-serif;
    font-size: 1.1em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    line-height: 1.3;
}

.highlight-icon {
    font-size: 1.2em;
    line-height: 1;
    color: var(--accent-warm);
    display: inline-flex;
    align-items: center;
}

.highlight-text {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 1.02em;
    line-height: 1.8;
    color: var(--text-color);
    margin: 0;
    text-align: justify;
    text-justify: inter-word;
}

/* רספונסיבי - רק במסכים צרים מאוד אחד מתחת לשני */
@media (max-width: 560px) {
    .highlights-grid > .highlight-card {
        flex: 1 1 100%;
    }
    .highlight-card {
        padding: 14px 18px;
    }
}

/* Video player */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 */
    height: 0;
    border-radius: var(--border-radius);
    overflow: hidden;
    background: black;
    box-shadow: var(--shadow-md);
    margin: 16px 0 24px;
}

.video-wrapper iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Transcript */
.transcript-container {
    background-color: var(--transcript-bg);
    padding: 28px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.transcript-container h1,
.transcript-container h2,
.transcript-container h3,
.transcript-container h4,
.transcript-container h5,
.transcript-container h6 {
    font-family: 'Assistant', sans-serif;
    color: var(--primary-color);
    margin-top: 1.4em;
    margin-bottom: 0.6em;
    line-height: 1.3;
}

.transcript-container > h1:first-child,
.transcript-container > h2:first-child,
.transcript-container > h3:first-child,
.transcript-container > h4:first-child {
    margin-top: 0;
}

.transcript-container h1 { font-size: 1.6em; font-weight: 700; }
.transcript-container h2 { font-size: 1.4em; font-weight: 600; }
.transcript-container h3 { font-size: 1.25em; font-weight: 600; color: var(--secondary-color); }
.transcript-container h4 {
    font-size: 1.15em;
    font-weight: 600;
    border-bottom: 2px solid rgba(3, 98, 128, 0.2);
    padding-bottom: 6px;
    margin-top: 1.6em;
}

.transcript-container p {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 1.05em;
    font-weight: 400;
    line-height: 1.85;
    margin-bottom: 1em;
    text-align: justify;
}

.transcript-container p strong {
    font-weight: 700;
    color: var(--primary-color);
}

.transcript-container ol, .transcript-container ul {
    padding-right: 24px;
    margin: 1em 0;
}

.transcript-container ol li, .transcript-container ul li {
    list-style: revert;
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 1.05em;
    line-height: 1.7;
    margin-bottom: 0.5em;
}

/* תצוגת PDF */
.pdf-viewer {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    height: 80vh;
    min-height: 500px;
    margin-bottom: 24px;
}

.pdf-viewer object {
    width: 100%;
    height: 100%;
    border: none;
}

.pdf-fallback {
    padding: 60px 24px;
    text-align: center;
    color: var(--accent-color);
}

.pdf-fallback p {
    margin-bottom: 20px;
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 1.1em;
}

@media (max-width: 640px) {
    .pdf-viewer { height: 60vh; min-height: 400px; }
}

/* No transcript notice */
.no-transcript-notice {
    background: white;
    padding: 24px;
    border-radius: var(--border-radius);
    text-align: center;
    color: var(--accent-color);
    font-style: italic;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

/* ===== Footer ===== */
.site-footer {
    background: var(--header-color);
    color: rgba(255,255,255,0.85);
    padding: 24px 16px;
    text-align: center;
    margin-top: auto;
    font-size: 0.92em;
}

.site-footer a {
    color: rgba(255,255,255,0.95);
    margin: 0 4px;
}

.site-footer a:hover {
    color: white;
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
    .header-padding { padding: 14px; }
    main.container { padding: 16px 12px; }
    .shiur-header { padding: 18px; }
    .transcript-container { padding: 18px; }
    .shiurim-grid { grid-template-columns: 1fr; }
}

/* ===== אנימציית כניסה לקוביות (בדפי הבית והעלונים) ===== */
.shiur-card[data-reveal] {
    opacity: 0;
}

.shiur-card[data-reveal].revealed {
    opacity: 1;
    animation: card-fade-in 0.4s ease-out backwards;
}

@keyframes card-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
}

/* כיבוד העדפת תנועה מופחתת - חשוב לנגישות */
@media (prefers-reduced-motion: reduce) {
    .shiur-card[data-reveal] {
        opacity: 1;
        animation: none;
    }
}

/* ===== וריאציה לדף אינדקס העלונים - כחול-פלדה ===== */
.pdf-index-body .shiur-card {
    border-right-color: var(--secondary-deep);
}

.pdf-index-body .shiur-card::before {
    border-color: var(--secondary-deep);
}

/* ===== Print ===== */
@media print {
    .site-header, .site-footer, .shiur-actions, .video-wrapper, .breadcrumbs {
        display: none;
    }
    body { background: white; }
    .transcript-container, .shiur-header {
        box-shadow: none;
        background: white;
        border: 1px solid #ddd;
    }
}

/* ==========================================================================
   דף 404 - הדף לא נמצא
   ========================================================================== */

.page-not-found .not-found-page {
    max-width: 800px;
    margin: 0 auto;
}

.not-found-header {
    text-align: center;
    padding: 32px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(1, 46, 74, 0.08);
    margin-bottom: 20px;
}

.not-found-code {
    font-family: 'Heebo', sans-serif;
    font-size: 3em;
    font-weight: 700;
    color: var(--secondary-color);
    letter-spacing: 0.05em;
    margin: 0 0 4px 0;
    line-height: 1;
    opacity: 0.85;
}

.not-found-page h1 {
    font-family: 'Frank Ruhl Libre', serif;
    font-size: clamp(1.5em, 4vw, 2em);
    color: var(--primary-color);
    margin: 8px 0 14px 0;
    line-height: 1.3;
}

.not-found-lead {
    font-size: 1.05em;
    color: var(--header-color);
    line-height: 1.7;
    max-width: 560px;
    margin: 0 auto;
}

/* כרטיס הצעת השיעור */
.shiur-suggestion {
    background: white;
    border-radius: 12px;
    padding: 22px;
    box-shadow: 0 2px 8px rgba(1, 46, 74, 0.08);
    margin-bottom: 20px;
    border-right: 4px solid var(--secondary-color);
}

.suggestion-intro {
    font-size: 1.1em;
    color: var(--primary-color);
    font-weight: 600;
    margin: 0 0 14px 0;
}

.suggestion-card {
    display: block;
    padding: 18px 20px;
    background: var(--background-color);
    border-radius: 8px;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(1, 46, 74, 0.1);
}

.suggestion-card:hover,
.suggestion-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(1, 46, 74, 0.14);
    outline: none;
}

.suggestion-number {
    display: block;
    font-size: 0.9em;
    color: var(--header-color);
    font-weight: 600;
    margin-bottom: 4px;
}

.suggestion-title {
    display: block;
    font-family: 'Frank Ruhl Libre', serif;
    font-size: 1.25em;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
    line-height: 1.35;
}

.suggestion-cta {
    display: block;
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.95em;
}

.not-found-actions {
    text-align: center;
    margin-top: 24px;
}

/* טקסט נסתר - נגישות (אם לא קיים כבר ב-styles.css) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 560px) {
    .not-found-header {
        padding: 24px 16px;
    }
    .not-found-code {
        font-size: 2.4em;
    }
    .shiur-suggestion,
    .not-found-search {
        padding: 18px;
    }
}
