/* ===== RESET & BASE STYLES ===== */
:root {
    /* Colors */
    --color-text: #000000;
    --color-background: #ffffff;
    --color-background-alt: #f8f8f8;
    --color-primary: #0000ff;
    --color-primary-hover: #003366;
    --color-secondary: #800080;
    --color-border: #cccccc;
    --color-overlay: rgba(0, 0, 0, 0.7);
    --color-text-light: #ffffff;

    /* Fonts */
    --font-primary: "darkmode-off-cc-hebrew", sans-serif;

    /* Spacing */
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 0.5rem;
    /* Reduced from 2rem as requested */
    --spacing-xl: 3rem;
}

[data-theme="dark"] {
    --color-text: #e0e0e0;
    --color-background: #1a1a1a;
    --color-background-alt: #2a2a2a;
    --color-primary: #0000ff;
    /* User requested specific blue */
    --color-primary-hover: #4d4dff;
    /* Lighter hover for visibility */
    --color-secondary: #0000ff;
    /* Visited links also blue in dark mode */
    /* User requested specific purple */
    --color-border: #444444;
    --color-overlay: rgba(255, 255, 255, 0.1);
    --color-text-light: #ffffff;
    --font-primary: "darkmode-on-cc-hebrew", sans-serif;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--color-text);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
}

.theme-toggle:hover {
    color: var(--color-primary);
}

.theme-toggle svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: transform 0.5s ease;
}

/* Sun/Moon Animation */
.theme-toggle .sun-icon {
    display: block;
}

.theme-toggle .moon-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .sun-icon {
    display: none;
}

[data-theme="dark"] .theme-toggle .moon-icon {
    display: block;
    transform: rotate(360deg);
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-primary);
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-background);
    font-size: 16px;
}

/* ===== TYPOGRAPHY ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-primary);
    font-weight: normal;
    line-height: 1.2;
    margin-bottom: var(--spacing-md);
    color: var(--color-text);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.1rem;
}

h6 {
    font-size: 1rem;
}

p {
    margin-bottom: var(--spacing-md);
    font-size: 1rem;
    color: var(--color-text);
}

a {
    text-decoration: none;
    /* Removed underline as requested */
    color: var(--color-primary);
    transition: color 0.2s ease;
}

.section-title {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 1px;
}

a:hover {
    color: var(--color-primary);
}

a:active {
    color: var(--color-secondary);
}

a:visited {
    color: var(--color-secondary);
}

/* ===== LAYOUT ===== */
.main-content {
    min-height: calc(100vh - 120px);
    padding-top: 80px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: var(--color-background);
    z-index: 1000;
    padding: var(--spacing-md) 0;
}

.nav-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: normal;
    color: var(--color-text);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    gap: var(--spacing-lg);
    align-items: center;
    list-style: none;
}

.nav-link {
    font-weight: normal;
    color: var(--color-primary);
    padding: var(--spacing-sm) 0;
    text-decoration: none;
    transition: color 0.2s ease;
}

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

.nav-link:active {
    color: var(--color-secondary);
}

.nav-link.active {
    color: var(--color-secondary);
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--color-background);
    border: 1px solid var(--color-border);
    border-radius: 0;
    box-shadow: none;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1001;
}

.dropdown:hover .dropdown-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-link {
    display: block;
    padding: 0.5rem var(--spacing-md);
    /* Reduced padding */
    color: var(--color-primary);
    text-decoration: underline;
    font-size: 0.9rem;
    /* Smaller font */
    transition: background-color 0.2s ease;
}

.dropdown-link:hover {
    background-color: var(--color-background-alt);
    color: var(--color-primary-hover);
}

.dropdown-link:visited {
    color: var(--color-secondary);
}

/* Mobile Navigation */
.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.nav-toggle span {
    width: 25px;
    height: 2px;
    background: var(--color-text);
    /* Adaptive color */
    transition: 0.3s;
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 75%;
        /* Slide out drawer */
        max-width: 300px;
        background: var(--color-background);
        /* Adaptive background */
        border-left: 1px solid var(--color-border);
        border-top: none;
        flex-direction: column;
        /* Restore vertical stack */
        align-items: flex-start;
        /* Left align items */
        padding: 5rem 2rem 2rem;
        /* Top padding for close/toggle area */
        transform: translateX(100%);
        /* Hidden to the right */
        transition: transform 0.3s ease-in-out;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
        z-index: 1000;
        overflow-y: auto;
    }

    .nav-menu.active {
        transform: translateX(0);
        /* Slide in */
    }

    .nav-toggle {
        z-index: 1001;
        /* Ensure toggle is above the menu */
        padding: 1rem;
        /* Increase touch area */
        margin-right: -1rem;
        /* Offset padding to keep visual position */
    }

    .nav-toggle {
        display: flex;
    }

    .dropdown-content {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        margin-top: 0;
        display: none;
        /* Hidden by default on mobile */
        padding-left: 1rem;
        /* Indent items */
        background: transparent;
        /* Removed gray background */
        margin-bottom: 0.5rem;
    }

    .dropdown.active .dropdown-content {
        display: block;
        /* Show when active */
    }

    .mobile-toggle {
        cursor: pointer;
        display: block;
        width: 100%;
        font-weight: normal;
        /* Un-bold */
        text-align: left;
    }

    .nav-link {
        width: 100%;
        text-align: left;
        padding: 0.75rem 0;
        /* Increase touch area */
    }
}

/* ===== HOMEPAGE ===== */
.homepage {
    padding: var(--spacing-lg) 0;
}

.projects-grid {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Force 3 columns */
    gap: var(--spacing-lg);
}

.project-card {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    background: var(--color-background);
    cursor: pointer;
    position: relative;
    z-index: 1;
}

.project-card:hover {
    background-color: var(--color-background-alt);
}

.project-thumbnail {
    position: relative;
    aspect-ratio: 4/5;
    overflow: hidden;
    background: var(--color-background-alt);
    border-radius: 4px;
    /* Small radius */
}

.project-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
    display: block;
}

.project-card:hover .project-thumbnail img {
    transform: scale(1.02);
}

.placeholder-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-background-alt);
    color: #666;
    font-size: 1.2rem;
    text-align: center;
    padding: var(--spacing-lg);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--color-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-title {
    color: var(--color-text-light);
    font-size: 1.5rem;
    text-align: center;
    padding: var(--spacing-md);
    font-weight: normal;
}

/* ===== PROJECT PAGE ===== */
.project-page {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--spacing-lg);
}

.project-header {
    text-align: center;
    margin-bottom: var(--spacing-xl);
    padding: var(--spacing-lg) 0;
}

.project-header .project-title {
    font-size: 2.5rem;
    margin-bottom: 0px;
    /* Reduced to 0 as requested */
    font-weight: normal;
    color: var(--color-text);
}

.project-meta {
    display: flex;
    justify-content: center;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    font-size: 0.8rem;
    /* Smaller font as requested */
    color: var(--color-text);
    margin-top: 0.15rem;
    /* Drastically reduced to tighten title/subtitle gap */
}

.meta-item {
    /* Removed frame styles */
    padding: 0;
    background: none;
}

.project-content {
    line-height: 1.8;
}

.content-block {
    margin-bottom: 2rem;
    /* Reduced from 3rem (xl) to 2rem as requested */
}

.text-block {
    font-size: 1.1rem;
}

.text-block p {
    margin-bottom: 1.5rem;
    color: var(--color-text);
}

.project-featured-image {
    width: 100%;
    height: auto;
    border-radius: 0;
    margin: var(--spacing-lg) 0;
    display: block;
}

/* ===== GALLERY ===== */
.gallery-block {
    margin: var(--spacing-xl) 0;
}

.gallery-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: normal;
    color: var(--color-text);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    /* Force 3 columns */
    gap: 1.5rem;
    margin-top: 1rem;
    align-items: start;
    /* Prevent stretching to row height */
}

.gallery-item-link {
    display: block;
    height: auto;
    /* Ensure wrapper doesn't stretch */
}

.gallery-item {
    position: relative;
    cursor: pointer;
    border-radius: 0;
    overflow: hidden;
    transition: all 0.2s ease;
    background: var(--color-background);
    height: auto;
    /* Natural height */
}

.gallery-item:hover {
    background-color: var(--color-background-alt);
    z-index: 10;
}

.gallery-item img {
    width: 100%;
    height: auto;
    /* Natural height */
    /* object-fit: cover removed to show full image */
    display: block;
    transition: transform 0.4s ease;
    /* Smoother transition */
}

.gallery-item:hover img {
    transform: scale(1.05);
    /* 5% upscale */
}

.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-overlay);
    color: var(--color-text-light);
    padding: 0.75rem;
    font-size: 0.9rem;
    text-align: center;
}

/* ===== VIDEO ===== */
.video-block {
    margin: var(--spacing-xl) 0;
}

.video-wrapper {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    /* 16:9 aspect ratio */
    background: var(--color-background-dark);
    border-radius: 0;
    overflow: hidden;
}

.video-wrapper iframe,
.video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* ===== QUOTE ===== */
.quote-block {
    margin: 3rem 0;
    text-align: center;
}

.quote-block blockquote {
    font-size: 1.3rem;
    font-style: italic;
    line-height: 1.6;
    margin: 0;
    padding: 2rem;
    background: var(--color-background-alt);
    border-left: 4px solid var(--color-primary);
    border-radius: 0;
}

.quote-block cite {
    display: block;
    margin-top: 1rem;
    font-size: 1rem;
    font-style: normal;
    color: var(--color-text);
}

/* ===== DIVIDER ===== */
.divider-block {
    margin: 3rem 0;
}

.divider-block hr {
    border: none;
    height: 1px;
    background: var(--color-border);
    margin: 0;
}

/* ===== FOOTER ===== */
/* ===== FOOTER ===== */
.footer {
    background: transparent;
    /* Removed background */
    border-top: none;
    /* Removed border */
    padding: 2rem 0 1rem;
    margin-top: 4rem;
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 2rem;
    text-align: center;
}

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

.social-link {
    display: inline-flex;
    /* Changed to flex for centering */
    width: 40px;
    /* Slightly smaller for cleaner look */
    height: 40px;
    background-color: transparent;
    /* No frame */
    color: var(--color-text);
    /* Default text color */
    align-items: center;
    justify-content: center;
    border: none;
    /* No frame */
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 4px;
    /* Slightly round corners */
}

/* Hover Effect: Blue Rectangle */
.social-link:hover {
    background-color: #0000ff;
    /* Blue rectangle */
    color: #ffffff;
    /* White icon */
}

.social-link:active {
    background-color: var(--color-secondary);
    color: #ffffff;
}

.social-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    vertical-align: middle;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .main-content {
        padding-top: 70px;
    }

    .nav-container {
        padding: 0 1rem;
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        /* 2 cols on tablet */
        padding: 0 1rem;
        gap: 1.5rem;
    }

    .project-page {
        padding: 1rem;
    }

    .project-header .project-title {
        font-size: 2rem;
    }

    .project-meta {
        flex-direction: column;
        gap: 1rem;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        /* Stack on mobile */
    }

    .social-links {
        flex-wrap: wrap;
    }

    .container {
        padding: 0 1rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }
}

@media (max-width: 480px) {
    .project-header .project-title {
        font-size: 1.5rem;
    }

    .gallery-item img {
        height: auto;
    }

    .quote-block blockquote {
        font-size: 1.1rem;
        padding: 1rem;
    }
}

/* ===== PHOTOSWIPE CUSTOMIZATION ===== */
.pswp__bg {
    background: rgba(0, 0, 0, 0.95);
    /* Darker background */
}

.pswp__caption {
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0));
    padding: 20px;
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

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

.mb-1 {
    margin-bottom: 1rem;
}

.mb-2 {
    margin-bottom: 2rem;
}

.mb-3 {
    margin-bottom: 3rem;
}

.mt-1 {
    margin-top: 1rem;
}

.mt-2 {
    margin-top: 2rem;
}

.mt-3 {
    margin-top: 3rem;
}

.p-1 {
    padding: 1rem;
}

.p-2 {
    padding: 2rem;
}

.p-3 {
    padding: 3rem;
}

/* ===== LOADING STATES ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* ===== SCREEN READER ONLY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}