/* Utility */
.hidden {
    display: none !important;
}

/* Variables & Design System */
:root {
    --primary-color: #e76f51;
    /* Terra Cotta */
    --secondary-color: #2a9d8f;
    /* Persian Green */
    --accent-color: #264653;
    /* Charcoal */
    --bg-color: #fdfcdc;
    /* Creamy White */
    --text-color: #2b2d42;
    /* Dark Blue/Grey */
    --light-grey: #f4f1de;

    --font-heading: 'Playfair Display', serif;
    --font-body: 'Lato', sans-serif;

    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    scroll-behavior: smooth;
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    color: var(--accent-color);
}

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

ul {
    list-style: none;
}

img {
    max-width: 100%;
    display: block;
    object-fit: cover;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

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

.section {
    padding: 80px 0;
}

.bg-light {
    background-color: var(--light-grey);
}

.section-title {
    text-align: center;
    font-size: 2.5rem;
    margin-bottom: 20px;
    position: relative;
    display: inline-block;
}

.section-subtitle {
    text-align: center;
    margin-bottom: 50px;
    color: #666;
    font-style: italic;
}

/* Page Header (Small Hero for internal pages) */
.page-header {
    padding: 120px 0 60px;
    /* More padding top to clear fixed header */
    background: var(--light-grey);
}

.page-header .section-title {
    font-size: 3rem;
    margin-bottom: 10px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn {
    display: inline-block;
    padding: 10px 25px;
    border-radius: 30px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
}

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

.btn-primary:hover {
    background-color: #d65a3b;
    transform: translateY(-2px);
}

.btn-secondary {
    border: 2px solid var(--accent-color);
    color: var(--accent-color);
    background: transparent;
}

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

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

.btn:hover {
    background-color: #218c7e;
    transform: translateY(-2px);
}


/* Navigation */
.main-header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-color);
}

.logo span {
    color: var(--primary-color);
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    font-weight: 700;
    font-size: 0.9rem;
    position: relative;
}

.nav-links a:not(.btn-primary)::after {
    content: '';
    display: block;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width .3s;
}

.nav-links a:not(.btn-primary):hover::after,
.nav-links a.active::after {
    width: 100%;
}

.burger {
    display: none;
    cursor: pointer;
}

.burger div {
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    margin: 5px;
    transition: var(--transition);
}

/* Hero Section */
.hero {
    min-height: 60vh;
    /* Changed from fixed 100vh to min-height */
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding-top: 80px;
    overflow: hidden;
}

.hero .container {
    display: flex;
    flex-direction: column-reverse;
    text-align: center;
    align-items: center;
    gap: 30px;
    width: 100%;
}

@media(min-width: 768px) {
    .hero .container {
        flex-direction: row;
        text-align: left;
        justify-content: space-between;
    }

    .hero-content {
        flex: 1;
    }

    .hero-image {
        flex: 1;
        display: flex;
        justify-content: center;
    }
}

.hero h1 {
    font-size: 3rem;
    line-height: 1.2;
    margin-bottom: 20px;
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    color: #555;
    max-width: 500px;
}

.placeholder-circle {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background-color: #ddd;
    border: 10px solid white;
    box-shadow: var(--shadow);
}

/* Gallery (Dessins) — Masonry layout, respecte les proportions */
.gallery-grid {
    column-width: 280px;
    column-gap: 25px;
}

.gallery-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: var(--shadow);
    background: #fff;
    break-inside: avoid;
    margin-bottom: 25px;
}

.placeholder-img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.gallery-item:hover .placeholder-img {
    transform: scale(1.1);
}

.overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px;
    transform: translateY(100%);
    transition: var(--transition);
}

.gallery-item:hover .overlay {
    transform: translateY(0);
}

/* Films Section */
.films-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
}

.film-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    display: flex;
    gap: 20px;
    align-items: start;
    transition: var(--transition);
}

.film-card:hover {
    transform: translateY(-5px);
}

.placeholder-film {
    width: 100px;
    height: 150px;
    flex-shrink: 0;
    border-radius: 5px;
    box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2);
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

.film-info h3 {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.film-info .director {
    font-size: 0.9rem;
    color: #888;
    display: block;
    margin-bottom: 10px;
    font-weight: 700;
}

.rating {
    color: #e9c46a;
    margin-top: 15px;
    font-size: 1.2rem;
}

/* Projects Section */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 80px;
}

.project-item {
    display: flex;
    flex-direction: column;
    gap: 40px;
    align-items: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 15px;
    cursor: pointer;
}

.project-link:hover .project-item {
    transform: translateY(-6px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

@media(min-width: 768px) {
    .project-item {
        flex-direction: row;
    }

    .project-item.reverse {
        flex-direction: row-reverse;
    }
}

.placeholder-project {
    width: 100%;
    height: 300px;
    border-radius: 15px;
    box-shadow: var(--shadow);
    flex: 1;
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
}

.project-content {
    flex: 1;
}

.project-content h3 {
    font-size: 2rem;
    margin-bottom: 20px;
}

.project-content p {
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.tags {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tags li {
    background: var(--light-grey);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Contact Form */
.contact-form-container {
    margin-top: 20px;
}

input:focus,
textarea:focus {
    outline: 2px solid var(--secondary-color);
    border-color: transparent;
}


/* Footer */
.main-footer {
    background: var(--accent-color);
    color: white;
    text-align: center;
    padding: 80px 0 40px;
    margin-top: 60px;
}

.main-footer h2 {
    color: white;
    margin-bottom: 15px;
}

.main-footer p {
    margin-bottom: 30px;
    color: rgba(255, 255, 255, 0.8);
}

/* Social Icons */
.social-links {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    gap: 30px;
}

.social-links a.social-icon,
.social-links a {
    color: white;
    font-size: 1.5rem;
    /* Bigger icons */
    transition: transform 0.3s ease, color 0.3s ease;
}

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

.social-links-row .social-icon {
    font-size: 2rem;
    color: var(--accent-color);
    transition: var(--transition);
}

.social-links-row .social-icon:hover {
    color: var(--primary-color);
    transform: translateY(-5px);
}

.copyright {
    font-size: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 30px;
    margin-top: 30px;
}

/* Mobile Nav */
@media screen and (max-width: 768px) {
    .nav-links {
        position: absolute;
        right: 0px;
        height: 92vh;
        top: 8vh;
        background-color: white;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 70%;
        transform: translateX(100%);
        transition: transform 0.5s ease-in;
        box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
        padding-top: 60px;
    }

    .nav-links li {
        opacity: 0;
    }

    .burger {
        display: block;
    }
}

.nav-active {
    transform: translateX(0%);
}

@keyframes navLinkFade {
    from {
        opacity: 0;
        transform: translateX(50px);
    }

    to {
        opacity: 1;
        transform: translateX(0px);
    }
}

.toggle .line1 {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.toggle .line2 {
    opacity: 0;
}

.toggle .line3 {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* ========== Project Detail Page ========== */
.project-view-wrapper {
    min-height: 80vh;
    transition: background-color 0.3s, color 0.3s;
    padding-top: 80px;
}

.project-view-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 60px 40px;
}

.project-view-container h1 {
    font-family: 'Playfair Display', serif;
    font-size: 2.8rem;
    margin-bottom: 30px;
}

.project-body {
    font-family: 'Lato', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    overflow-wrap: break-word;
    word-break: break-word;
}

.project-body h1,
.project-body h2,
.project-body h3 {
    font-family: 'Playfair Display', serif;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.project-body img {
    max-width: 100%;
    border-radius: 8px;
    margin: 20px 0;
    display: block;
    height: auto;
}

/* Image sizing classes (set via Quill editor) */
.project-body img.img-size-25 {
    width: 25%;
}

.project-body img.img-size-50 {
    width: 50%;
}

.project-body img.img-size-75 {
    width: 75%;
}

.project-body img.img-size-100 {
    width: 100%;
}

/* Image alignment handled by flexbox .content-row wrappers (created by project.js) */
.project-body img.img-align-center {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ========== Flexbox Image+Text Rows (created by project.js) ========== */
.content-row {
    display: flex;
    gap: 25px;
    align-items: flex-start;
    margin: 20px 0;
}

.content-row-left {
    flex-direction: row;
}

.content-row-right {
    flex-direction: row-reverse;
}

.content-row .content-row-img {
    flex-shrink: 0;
}

.content-row .content-row-img img {
    display: block;
    border-radius: 8px;
    width: 100%;
    height: auto;
    margin: 0;
}

/* Size mapping for images inside content-row */
.content-row .content-row-img.img-w-25 {
    width: 25%;
}

.content-row .content-row-img.img-w-50 {
    width: 50%;
}

.content-row .content-row-img.img-w-75 {
    width: 75%;
}

.content-row .content-row-img.img-w-100 {
    width: 100%;
}

.content-row .content-row-text {
    flex: 1;
    min-width: 0;
}

.content-row .content-row-text p {
    margin: 0 0 0.8em 0;
}

/* Responsive: stack on mobile */
@media (max-width: 600px) {
    .content-row {
        flex-direction: column;
    }

    .content-row .content-row-img.img-w-25,
    .content-row .content-row-img.img-w-50,
    .content-row .content-row-img.img-w-75 {
        width: 100%;
    }
}

.project-body ul,
.project-body ol {
    padding-left: 2em;
    margin: 1em 0;
}

.project-body blockquote {
    border-left: 4px solid currentColor;
    opacity: 0.8;
    padding-left: 1em;
    margin: 1.5em 0;
    font-style: italic;
}

.project-body a {
    color: inherit;
    text-decoration: underline;
}

.back-nav {
    margin-bottom: 30px;
}

.back-nav a {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s, transform 0.2s;
}

.back-nav a:hover {
    opacity: 1;
    transform: translateX(-5px);
}

.project-status {
    text-align: center;
    padding: 80px 20px;
    font-size: 1.2rem;
}

.project-status i {
    font-size: 3rem;
    margin-bottom: 20px;
    display: block;
}

/* ========== Lightbox ========== */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90vh;
}

.lightbox-img {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 5px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.5);
    display: block;
}

.lightbox-caption {
    position: absolute;
    bottom: -40px;
    left: 0;
    width: 100%;
    text-align: center;
    color: white;
    font-family: var(--font-heading);
    font-size: 1.2rem;
}

.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: white;
    font-size: 3rem;
    cursor: pointer;
    padding: 20px;
    opacity: 0.7;
    transition: opacity 0.3s;
    user-select: none;
}

.lightbox-btn:hover {
    opacity: 1;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 2.5rem;
    color: white;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.3s;
    background: transparent;
    border: none;
}

.lightbox-close:hover {
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .lightbox-btn {
        font-size: 2rem;
        padding: 10px;
    }

    .lightbox-prev {
        left: 5px;
    }

    .lightbox-next {
        right: 5px;
    }
}

/* Filters (Dessins) - Custom Select */
.filters-container {
    text-align: center;
    margin-bottom: 40px;
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 10;
}

/* Hide native select but keep accessible? Or just display:none and rely on aria? 
   For simplicity, we hide it visually. */
.filter-select {
    display: none;
}

.custom-select-wrapper {
    position: relative;
    user-select: none;
    width: 250px;
}

.custom-select {
    position: relative;
    display: flex;
    flex-direction: column;
}

.custom-select__trigger {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-color);
    background: #ffffff;
    border: 2px solid var(--accent-color);
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.custom-select__trigger:hover {
    border-color: var(--primary-color);
}

.custom-select__trigger::after {
    content: '\25BC';
    /* Down arrow */
    font-size: 0.7em;
    margin-left: 10px;
    transition: transform 0.3s;
}

.custom-select.open .custom-select__trigger::after {
    transform: rotate(180deg);
}

.custom-options {
    position: absolute;
    display: block;
    top: 100%;
    left: 0;
    right: 0;
    border: 2px solid var(--accent-color);
    border-radius: 15px;
    border-top: 0;
    background: #fff;
    transition: all 0.3s ease;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    z-index: 20;
    margin-top: 10px;
    overflow: hidden;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

.custom-select.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    top: 110%;
    /* Slight offset animation */
}

.custom-option {
    position: relative;
    display: block;
    padding: 12px 20px;
    font-size: 0.95rem;
    font-weight: 400;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.custom-option:last-of-type {
    border-bottom: none;
}

.custom-option:hover,
.custom-option.selected {
    background-color: var(--primary-color);
    color: white;
}