/* --- MODERN & CLEAN THEME --- */

/* 1. General Setup & Variables */
:root {
    --primary-color: #C0A062;
    --bg-warm-start: #242021;
    --bg-warm-end: #181516;
    --surface-color: #1E1E1E;
    --border-color: rgba(255, 255, 255, 0.1);
    --text-color: #b3b3b3;
    --heading-color: #ffffff;
    --title-font: 'Poppins', sans-serif;
    --body-font: 'Inter', sans-serif;
    --hebrew-font: 'Assistant', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--body-font);
    color: var(--text-color);
    background: radial-gradient(ellipse at center, var(--bg-warm-start) 0%, var(--bg-warm-end) 100%);
    background-attachment: fixed;
    text-align: center;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 2. Modern Header and Navigation */
header {
    padding: 1rem 5%;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    background: rgba(18, 18, 18, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-brand {
    font-family: var(--title-font);
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--heading-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-brand:hover {
    color: var(--primary-color);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 0.5rem;
}

nav ul .nav-link {
    color: var(--text-color);
    text-decoration: none;
    font-size: 1.05rem;
    font-weight: 400;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

nav ul .nav-link:hover {
    color: var(--heading-color);
    background-color: var(--surface-color);
}

nav ul .nav-link.active {
    color: var(--bg-warm-end);
    background-color: var(--primary-color);
    font-weight: 500;
}

/* 3. Main Content & Animations */
main {
    padding: 8rem 1rem 4rem;
}

.content-section {
    display: none;
    max-width: 1000px;
    margin: 0 auto;
}

.content-section.active {
    display: block;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.content-section.active > * {
    animation: fadeInUp 0.6s ease-out 0.2s backwards;
}
.content-section.active > *:nth-child(2) { animation-delay: 0.3s; }
.content-section.active > *:nth-child(3) { animation-delay: 0.4s; }
.content-section.active > *:nth-child(4) { animation-delay: 0.5s; }

/* 4. Section-Specific Styles */

/* Home Section */
.profile-photo {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-color);
    margin-bottom: 2rem;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
}

.main-title {
    font-family: var(--title-font);
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--heading-color);
}

.about-text {
    max-width: 600px;
    margin: 0 auto 2.5rem;
    font-size: 1.25rem;
    line-height: 1.7;
}

.social-links a {
    color: var(--text-color);
    font-size: 1.4rem;
    margin: 0 1rem;
    transition: color 0.3s ease, transform 0.3s ease;
}

.social-links a:hover {
    color: var(--primary-color);
    transform: translateY(-3px);
}

/* General Section Title */
.section-title {
    font-family: var(--title-font);
    font-size: 2.8rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--heading-color);
}

/* Author Section */
.author-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4rem;
}

.book-showcase {
    display: flex;
    gap: 2.5rem;
    align-items: center;
    background: var(--surface-color);
    padding: 2.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    max-width: 900px;
    width: 100%;
    transition: all 0.4s ease;
    flex-direction: row-reverse;
}

.book-showcase:hover {
    transform: translateY(-5px);
    border-color: color-mix(in srgb, var(--primary-color) 40%, transparent);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2), 0 0 20px color-mix(in srgb, var(--primary-color) 25%, transparent);
}

.book-cover-img {
    max-width: 250px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transition: transform 0.4s ease;
    flex-shrink: 0;
}

.book-cover-img:hover {
    transform: scale(1.05);
}

.book-description {
    text-align: right;
    direction: rtl;
}

.book-description h3 {
    font-family: var(--title-font);
    font-size: 2rem;
    font-weight: 500;
    color: var(--heading-color);
    margin-bottom: 1rem;
}

.book-description p {
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1rem;
}

.book-links-container {
    width: 100%;
    max-width: 700px;
}

.book-links-container h4 {
    font-family: var(--title-font);
    font-size: 1.3rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--heading-color);
}

.book-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.book-link {
    background: transparent;
    color: var(--primary-color);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    border: 1px solid var(--primary-color);
    transition: all 0.3s ease;
    direction: rtl;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-grow: 1;
    min-width: 150px;
}

.book-link:hover {
    background: var(--primary-color);
    color: var(--bg-warm-end);
}

/* Painter Section */
.gallery-intro {
    margin-bottom: 3rem;
    font-size: 1.25rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    width: 100%;
    margin-top: 20px;
    padding-bottom: 50px;
}

.gallery-item {
    height: 250px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: transparent;
    transform: translateZ(0);
    will-change: transform;
    backface-visibility: hidden;
}

.gallery-item:hover {
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
    z-index: 10;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Sentinel for infinite scroll */
.gallery-sentinel {
    grid-column: 1 / -1;
    height: 20px;
}

/* Bio Separator */
.bio-separator {
    border: 0;
    height: 1px;
    background-image: linear-gradient(to right, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    margin: 3rem auto;
    width: 80%;
}

/* Popup Styling */
#popup {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: transparent;
    padding: 0;
    border-radius: 8px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.8);
    z-index: 2000;
    max-width: 95vw;
    max-height: 95vh;
    text-align: center;
    pointer-events: none; 
    overflow: hidden;
}

#popup img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    pointer-events: auto;
}

.popup-details {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 15px;
    color: #fff;
    font-family: 'Assistant', sans-serif;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    text-shadow: 0 1px 3px rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: auto;
}

#popup-desc {
    margin: 0;
    font-size: 1.2rem;
}

.popup-meta {
    display: flex;
    gap: 20px;
    font-size: 1rem;
    align-items: center;
}

.popup-meta a {
    color: #fff;
    text-decoration: underline;
    pointer-events: auto;
}

.popup-meta a:hover {
    color: #ddd;
}

/* 5. Responsive Adjustments */
@media (max-width: 768px) {
    .main-title { font-size: 2.8rem; }
    .section-title { font-size: 2.2rem; }

    nav {
        flex-direction: column;
        gap: 1rem;
    }

    /* Mobile Navigation Fix */
    nav ul {
        width: 100%;
        justify-content: center;
        gap: 0.2rem; /* Reduce gap */
    }

    nav ul .nav-link {
        font-size: 0.85rem; /* Smaller font */
        padding: 0.5rem 0.8rem; /* Smaller padding */
        white-space: nowrap; /* Prevent wrapping */
    }

    .book-showcase {
        flex-direction: column;
        padding: 1.5rem;
        gap: 2rem;
    }

    .book-description {
        text-align: right;
    }
}

/* 6. Hebrew Font Overrides */
#author .section-title,
#author .book-description h3,
#author .book-links-container h4 {
    font-family: var(--hebrew-font);
}

.book-description p {
    font-family: var(--hebrew-font);
    font-size: 1.1rem;
    line-height: 1.9;
}

.book-link {
    font-family: var(--hebrew-font);
    font-weight: 700;
}

/* 7. Accessibility Helpers (Required by Law) */
.skip-link {
    position: absolute;
    top: -40px;
    right: 0;
    background: #000;
    color: #fff;
    padding: 8px;
    z-index: 1001; /* Higher than header */
    transition: top 0.3s;
    text-decoration: none;
    font-family: var(--hebrew-font);
    border-radius: 0 0 0 5px;
}

.skip-link:focus {
    top: 0;
}

/* Focus indicator for keyboard navigation */
*:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 4px;
}

/* --- ACCESSIBILITY TOOLBAR STYLES --- */

/* The Floating Button */
.a11y-toolbar-container {
    position: fixed;
    bottom: 20px;
    left: 20px; /* Left side for Hebrew sites usually, or right if preferred */
    z-index: 9999;
    font-family: var(--hebrew-font);
}

.a11y-btn {
    background: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
    transition: transform 0.3s ease;
}

.a11y-btn:hover, .a11y-btn:focus {
    transform: scale(1.1);
}

/* The Menu */
.a11y-menu {
    display: none; /* Hidden by default */
    position: absolute;
    bottom: 60px;
    left: 0;
    background: #fff;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 10px;
    width: 200px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    flex-direction: column;
    gap: 8px;
}

.a11y-menu.open {
    display: flex;
}

.a11y-menu button {
    background: #f0f0f0;
    border: 1px solid #ccc;
    padding: 8px;
    cursor: pointer;
    font-family: var(--hebrew-font);
    font-weight: bold;
    text-align: right;
    transition: background 0.2s;
    color: #000;
}

.a11y-menu button:hover, .a11y-menu button:focus {
    background: var(--primary-color);
    color: #fff;
}

/* --- ACCESSIBILITY MODES (Applied via JS) --- */

/* 1. Large Text Mode */
body.a11y-large-text {
    font-size: 125%; /* Increase base font size */
}

/* 2. High Contrast Mode (Yellow on Black) */
body.a11y-high-contrast {
    background: #000 !important;
    color: #ffff00 !important;
}

body.a11y-high-contrast * {
    background-color: #000 !important;
    color: #ffff00 !important;
    border-color: #ffff00 !important;
    box-shadow: none !important;
    text-shadow: none !important;
}

body.a11y-high-contrast img {
    filter: grayscale(100%) contrast(120%);
}

/* 3. Highlight Links */
body.a11y-links-highlight a {
    text-decoration: underline !important;
    background-color: #000 !important;
    color: #ffff00 !important;
    font-weight: bold;
}

/* --- TESTIMONIALS SECTION --- */
.testimonials-wrapper {
    width: 100vw; /* Full viewport width */
    margin-left: calc(-50vw + 50%); /* Break out of container */
    margin-right: calc(-50vw + 50%);
    overflow: hidden;
    padding: 40px 0;
    background: rgba(0, 0, 0, 0.3);
    position: relative;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.testimonials-track {
    display: flex;
    gap: 0;
    width: max-content;
    animation: scroll 180s linear infinite;
    flex-wrap: nowrap;
    will-change: transform;
}

.testimonial-card {
    background: var(--surface-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    min-width: 320px;
    max-width: 320px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
    direction: rtl; /* Ensure Hebrew text is RTL inside the LTR track */
    margin-right: 2rem;
}

.testimonial-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: 0 8px 25px rgba(192, 160, 98, 0.15);
}

.testimonial-text {
    font-size: 1.05rem;
    font-style: italic;
    margin-bottom: 1rem;
    color: #e0e0e0;
}

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}