/* =========================================
   Moayad Alayan - Modern Portfolio Styles
   ========================================= */

/* --- Variables --- */
:root {
    --bg-color: #FAFAFA;
    --text-primary: #111111;
    --text-secondary: #666666;
    --border-color: #E5E5E5;
    --accent: #000000;
    --about-bg: #F2F2F2;
    --card-bg: #EAEAEA;
    
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
    
    --container-width: 1400px;
    --nav-height: 80px;
    
    --transition: 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Dark Mode Variables --- */
[data-theme="dark"] {
    --bg-color: #0A0A0A;
    --text-primary: #F0F0F0;
    --text-secondary: #888888;
    --border-color: #2A2A2A;
    --accent: #F0F0F0;
    --about-bg: #111111;
    --card-bg: #1A1A1A;
}

/* Smooth color transitions when toggling dark mode */
body {
    transition: background-color 0.4s ease, color 0.4s ease;
}

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

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

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

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

a {
    color: inherit;
    text-decoration: none;
}

ul {
    list-style: none;
}

button {
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    color: inherit;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

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

/* --- Navigation --- */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    background-color: rgba(250, 250, 250, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition), background-color 0.4s ease;
}

[data-theme="dark"] .nav {
    background-color: rgba(10, 10, 10, 0.85);
}

.nav.scrolled {
    border-bottom: 1px solid var(--border-color);
}

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

.nav-logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-link {
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition);
}

.nav-link:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* --- Dark Mode Toggle Button --- */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
    flex-shrink: 0;
}

.dark-mode-toggle:hover {
    background-color: var(--text-primary);
    color: var(--bg-color);
    transform: rotate(15deg);
}

.dark-mode-toggle .icon-sun {
    display: none;
}

.dark-mode-toggle .icon-moon {
    display: block;
}

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

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

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 24px;
    height: 20px;
    z-index: 101;
}

.menu-toggle-line {
    width: 100%;
    height: 2px;
    background-color: var(--text-primary);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.mobile-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.mobile-nav.is-active {
    opacity: 1;
    pointer-events: all;
}

.mobile-nav-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.mobile-nav-link {
    font-family: var(--font-display);
    font-size: 2.5rem;
    font-weight: 500;
}

/* Mobile Nav Toggle Animation */
.menu-toggle.is-active .menu-toggle-line:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}
.menu-toggle.is-active .menu-toggle-line:nth-child(2) {
    transform: translateY(-9px) rotate(-45deg);
}

/* --- Hero Section --- */
.hero {
    padding-top: calc(var(--nav-height) + 8rem);
    padding-bottom: 4rem;
    min-height: 50vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero-title {
    font-size: clamp(3rem, 7vw, 6rem);
    margin-bottom: 2rem;
    max-width: 900px;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--text-secondary);
    max-width: 600px;
    line-height: 1.6;
}

/* --- Hero Video Section --- */
.hero-video {
    padding-bottom: 6rem;
}

.hero-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 45%; /* Cinematic wide aspect ratio */
    background-color: var(--border-color);
    overflow: hidden;
}

.hero-video-wrapper video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- Work Section --- */
.work {
    padding: 6rem 0;
}

.work-header {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 4rem;
}

@media (min-width: 768px) {
    .work-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-end;
    }
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
}

.work-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-btn {
    font-size: 0.9rem;
    padding: 0.5rem 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    transition: all var(--transition);
}

.filter-btn:hover, .filter-btn.active {
    background-color: var(--text-primary);
    color: var(--bg-color);
    border-color: var(--text-primary);
}

.work-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media (min-width: 768px) {
    .work-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 3rem;
    }
}

/* Make every 3rd item span 2 columns for masonry feel on desktop */
@media (min-width: 768px) {
    .project-card.featured {
        grid-column: 1 / -1;
    }
    
    .project-card.featured .project-image-container {
        padding-bottom: 40%; /* wider aspect ratio for featured */
    }
}

.project-card {
    display: block;
    cursor: pointer;
    group: project;
}

.project-image-container {
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    position: relative;
    overflow: hidden;
    background-color: var(--card-bg);
    margin-bottom: 1.25rem;
    transition: background-color 0.4s ease;
}

.project-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .project-image {
    transform: scale(1.03);
}

.project-info {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.project-title {
    font-size: 1.25rem;
    font-family: var(--font-sans);
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.project-category {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.project-view-indicator {
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0;
    transform: translateX(-10px);
    transition: all var(--transition);
}

.project-card:hover .project-view-indicator {
    opacity: 1;
    transform: translateX(0);
}

/* --- About Section --- */
.about {
    padding: 6rem 0;
    background-color: var(--about-bg);
    transition: background-color 0.4s ease;
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
    align-items: center;
}

@media (min-width: 900px) {
    .about-grid {
        grid-template-columns: 1fr 1fr;
        gap: 6rem;
    }
}

.about-image-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 120%; /* Portrait aspect ratio */
    overflow: hidden;
}

.about-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.about-content .section-title {
    margin-bottom: 2rem;
}

.about-name {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.about-bio {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 500px;
}

.about-skills h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.skills-list li {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    background-color: var(--bg-color);
}

/* --- Contact Section --- */
.contact {
    padding: 10rem 0;
    text-align: center;
}

.contact-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    margin-bottom: 2rem;
}

.contact-email {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 400;
    position: relative;
    display: inline-block;
    margin-bottom: 4rem;
}

.contact-email::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent);
    transition: transform var(--transition);
    transform-origin: right;
}

.contact-email:hover::after {
    transform: scaleX(0);
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.contact-link {
    font-size: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

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

/* --- Footer --- */
.footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
}

.footer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

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

.copyright {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.back-to-top {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.back-to-top:hover {
    color: var(--text-primary);
}

/* --- Project Detail Page Styles --- */
.project-page {
    padding-top: var(--nav-height);
}

.project-hero {
    padding: 6rem 0 3rem;
}

.back-link {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
    color: var(--text-secondary);
    transition: color var(--transition);
}

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

.project-hero-title {
    font-size: clamp(3rem, 6vw, 5rem);
    margin-bottom: 1rem;
}

.project-video-section {
    margin-bottom: 4rem;
}

.project-video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 Aspect Ratio */
    background-color: #000;
    overflow: hidden;
}

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

.project-details {
    padding-bottom: 8rem;
}

.project-details-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4rem;
}

@media (min-width: 900px) {
    .project-details-grid {
        grid-template-columns: 300px 1fr;
        gap: 6rem;
    }
}

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

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.meta-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.meta-value {
    font-size: 1.1rem;
    font-weight: 500;
}

.project-story {
    display: flex;
    flex-direction: column;
    gap: 3rem;
}

.story-section h2 {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.story-section p {
    font-size: 1.1rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.project-loading {
    padding: 10rem 0;
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-secondary);
}

/* Mobile Nav Adjustments */
@media (max-width: 767px) {
    .nav-links {
        display: none;
    }
    .menu-toggle {
        display: flex;
    }
}
