/* ═══════════════════════════════════════════════════
   Sara Bensalem — Portfolio Stylesheet
   Designer / Educator / Researcher
   ═══════════════════════════════════════════════════ */

/* ─── Base Variables & Reset ─── */
:root {
    --bg-color: #fdfdfd;
    --text-primary: #121212;
    --text-secondary: #4a4a4a;
    --text-muted: #888888;
    --accent: #c49a6c;
    --accent-dark: #a67f55;
    --accent-light: #e6d3bd;
    --border-color: #ededed;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    --container-width: 1300px;
    --padding-global: 60px;
    --transition-smooth: cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-soft: 0 4px 30px rgba(0, 0, 0, 0.04);
    --shadow-medium: 0 10px 50px rgba(0, 0, 0, 0.08);
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    outline-offset: 4px;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

body.no-scroll {
    overflow: hidden;
}

::selection {
    background: var(--accent-light);
    color: var(--text-primary);
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s var(--transition-smooth);
}

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

/* ─── Typography ─── */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 400;
    line-height: 1.1;
}

h2 {
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 2rem;
}

h3 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

p {
    margin-bottom: 1rem;
}

.label-caps {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: var(--accent);
    font-weight: 600;
    display: block;
    margin-bottom: 1rem;
}

/* ─── Custom Scrollbar ─── */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.98);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.2, 1, 0.3, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

.reveal-left {
    opacity: 0;
    transform: translateX(-40px);
    transition: opacity 1.2s var(--transition-smooth), transform 1.2s var(--transition-smooth);
}

.reveal-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.reveal-delay-1 {
    transition-delay: 0.15s;
}

.reveal-delay-2 {
    transition-delay: 0.3s;
}

.reveal-delay-3 {
    transition-delay: 0.45s;
}

/* ─── Navigation ─── */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(253, 253, 253, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    z-index: 2000;
    padding: 1.75rem 0;
    transition: padding 0.4s var(--transition-smooth), background 0.4s ease;
}

.navbar.scrolled {
    padding: 1.1rem 0;
    box-shadow: var(--shadow-soft);
}

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

.logo {
    font-family: var(--font-heading);
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.nav-links {
    display: flex;
    gap: 40px;
}

.nav-links a {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    color: var(--text-secondary);
    position: relative;
    padding: 5px 0;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    transition: width 0.4s var(--transition-smooth);
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text-primary);
}

/* Nav Toggle & Mobile */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 2101;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background: var(--text-primary);
    margin: 6px 0;
    transition: all 0.4s var(--transition-smooth);
}

.nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: translateX(10px);
}

.nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

.nav-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* ─── Hero Sections ─── */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 120px var(--padding-global);
    position: relative;
    overflow: hidden;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 1px;
    height: 60px;
    background: linear-gradient(to bottom, var(--accent), transparent);
    animation: scrollLine 2s infinite;
}

@keyframes scrollLine {
    0% {
        transform: translate(-50%, -20px);
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
}

.hero-content {
    max-width: 900px;
    z-index: 1;
}

.hero-content h1 {
    font-size: clamp(3rem, 8vw, 5.5rem);
    margin-bottom: 2rem;
    font-style: italic;
    color: var(--text-primary);
}

.hero-content p {
    font-size: 1.4rem;
    color: var(--text-secondary);
    margin-bottom: 3.5rem;
    max-width: 650px;
    margin-inline: auto;
    font-weight: 300;
}

/* Standard Page Hero */
.page-hero {
    min-height: 60vh;
    background-color: #121212;
    background-size: cover;
    background-position: center;
    position: relative;
    display: flex;
    align-items: center;
    padding: 180px var(--padding-global) 100px;
    color: white;
}

.page-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0.4) 100%);
}

.page-hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
}

.page-hero h1 {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    margin-bottom: 1.5rem;
    color: #fff;
}

.page-hero p {
    font-size: 1.15rem;
    color: rgba(255, 255, 255, 0.7);
    max-width: 550px;
}

/* ─── Buttons ─── */
.btn-primary,
.btn-secondary {
    display: inline-block;
    padding: 1.1rem 2.8rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-weight: 600;
    transition: all 0.5s var(--transition-smooth);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-primary {
    background-color: var(--text-primary);
    color: white;
    border: 1px solid var(--text-primary);
}

.btn-primary:hover {
    color: var(--text-primary);
    background: transparent;
}

.btn-secondary {
    border: 1px solid var(--text-primary);
    color: var(--text-primary);
}

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

/* ─── Sections ─── */
.section {
    padding: clamp(80px, 12vw, 160px) 0;
}

.bg-light {
    background-color: #faf9f6;
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 var(--padding-global);
}

.section-title {
    margin-bottom: 4rem;
}

.section-title .label {
    display: block;
    font-size: 0.75rem;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 1rem;
    font-weight: 700;
}

/* ─── Project Gallery & Grid ─── */
.grid-projects {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: clamp(20px, 4vw, 50px);
}

.project-card {
    position: relative;
    aspect-ratio: 4/5;
    overflow: hidden;
    background: #eee;
}

.project-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s var(--transition-smooth);
}

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

.project-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.1) 60%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 40px;
    opacity: 0.9;
    color: white;
    transition: all 0.5s ease;
}

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

.project-overlay h3 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.project-overlay p {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.8rem;
    color: var(--accent-light);
    margin-bottom: 0;
}

/* Detail Gallery Grid */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.gallery-item {
    aspect-ratio: 3/2;
    overflow: hidden;
    cursor: zoom-in;
    background-color: #f5f5f5;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--transition-smooth), filter 0.5s ease;
}

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

.gallery-grid .gallery-item:first-child {
    grid-column: span 2;
    grid-row: span 2;
}

/* ─── Research Elements ─── */
.research-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 30px;
}

.research-card {
    padding: 50px 40px;
    background: white;
    border: 1px solid var(--border-color);
    transition: all 0.4s var(--transition-smooth);
}

.research-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-medium);
}

.research-card h3 {
    font-size: 1.5rem;
    margin-bottom: 1.2rem;
}

.research-card p {
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* ─── CV / About ─── */
.cv-section {
    margin-bottom: 6rem;
}

.cv-row {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 40px;
    margin-bottom: 3rem;
}

.cv-year {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--accent);
}

/* ─── Lightbox ─── */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 10, 0.98);
    display: none;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.gallery-lightbox.active {
    display: flex;
}

#lightbox-img {
    max-width: 90vw;
    max-height: 85vh;
    object-fit: contain;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    font-size: 2.5rem;
    color: #fff;
    cursor: pointer;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 20px;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: absolute;
    bottom: 30px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    letter-spacing: 2px;
}

/* ─── Footer ─── */
footer {
    background: #0a0a0a;
    color: #fff;
    padding: 100px 0 40px;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding-bottom: 60px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 40px;
}

.footer-logo {
    font-size: 2rem;
}

.footer-links-group {
    display: flex;
    gap: 60px;
}

.footer-column h4 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.footer-column a {
    display: block;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.footer-column a:hover {
    color: #fff;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
}

/* ─── Utilities ─── */
.text-center {
    text-align: center;
}

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

/* ─── Responsive ─── */
@media (max-width: 1024px) {
    :root {
        --padding-global: 40px;
    }

    .grid-projects {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100vh;
        background: #fff;
        flex-direction: column;
        padding: 120px 40px;
        gap: 20px;
        transition: 0.5s var(--transition-smooth);
        z-index: 2000;
    }

    .nav-links.open {
        right: 0;
    }

    .research-grid {
        grid-template-columns: 1fr;
    }

    .footer-top {
        flex-direction: column;
        gap: 40px;
    }

    .gallery-grid {
        grid-template-columns: 1fr 1fr;
    }

    .gallery-grid .gallery-item:first-child {
        grid-column: span 2;
    }
}