/*
 * Stylesheet for Selin Kaya's UI/UX portfolio
 * Primary color palette follows the 60-30-10 rule: a soft gray base, vibrant purple accents and a complementary highlight color.
 */

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

/* Performance optimizations */
html {
    scroll-behavior: smooth;
    overflow-x: hidden; /* Prevent horizontal scroll */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

html {
    scroll-behavior: smooth;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

body {
    font-family: 'Open Sans', sans-serif;
    color: #333;
    background-color: #f7f7f7;
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scroll */
    width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* Variables for colors */
:root {
    --primary: #6c5dd3; /* purple */
    --secondary: #f7f7f7; /* light gray */
    --accent: #ff6584; /* accent pink */
    --text-dark: #333;
    --text-light: #fff;
}

/* Container utility */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px; /* Add padding for mobile */
}

@media (max-width: 768px) {
    .container {
        width: 100%;
        padding: 0 20px; /* More padding on mobile */
    }
}

/* Header styles */
header {
    position: sticky;
    top: 0;
    background-color: var(--primary);
    z-index: 1000;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

header .logo {
    font-family: 'Poppins', sans-serif;
    color: var(--text-light);
    font-size: 1.6rem;
    font-weight: 600;
}

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

nav a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--accent);
}

/* Mobile Menu */
.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 6px;
}

.menu-toggle .bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-light);
    transition: all 0.3s ease;
}

/* Hero Section */
.hero {
    position: relative;
    height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-light);
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.8s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 800px;
    padding: 0 1rem;
    animation: slideUp 1s ease-out 0.3s both;
}

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

.hero h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.125rem;
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    background-color: var(--accent);
    color: var(--text-light);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    text-decoration: none;
    transition: background-color 0.3s ease;
}

.btn:hover {
    background-color: #e24d6e;
}

/* About Section */
.about {
    padding: 4rem 0;
    background-color: var(--secondary);
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    align-items: center;
    gap: 2rem;
}

.about-text h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.about-text p {
    margin-bottom: 1rem;
    text-align: justify;
}

.about-image img {
    width: 100%;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Services Section */
.services {
    padding: 4rem 0;
}

.services h2 {
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--primary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.service-item {
    background-color: #fff;
    border-radius: 10px;
    padding: 2rem 1.5rem;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.service-item:hover {
    transform: translateY(-5px);
}

.service-item i {
    color: var(--primary);
    margin-bottom: 1rem;
}

.service-item h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.service-item p {
    font-size: 0.95rem;
    color: var(--text-dark);
}

/* Projects Section */
.projects {
    padding: 4rem 0;
    background-color: var(--secondary);
}

.projects h2 {
    text-align: center;
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--primary);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.project-card {
    position: relative;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
}

.project-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

.project-info {
    padding: 1rem;
    background-color: #fff;
}

.project-info h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.project-info p {
    font-size: 0.95rem;
    color: var(--text-dark);
}

/* Contact Section */
.contact {
    padding: 4rem 0;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    align-items: start;
}

.contact-info h2 {
    font-family: 'Poppins', sans-serif;
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.contact-info ul {
    list-style: none;
    margin-top: 1rem;
}

.contact-info li {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    color: var(--text-dark);
}

.contact-info i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.contact-info a {
    color: var(--text-dark);
    text-decoration: none;
    transition: color 0.3s ease;
}

.contact-info a:hover {
    color: var(--accent);
}

.contact-form form {
    display: flex;
    flex-direction: column;
}

.contact-form label {
    margin-bottom: 0.3rem;
    font-weight: 600;
    color: var(--primary);
}

.contact-form input,
.contact-form textarea {
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
}

.contact-form textarea {
    resize: vertical;
}

.contact-form button {
    background-color: var(--primary);
    color: var(--text-light);
    padding: 0.75rem;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.contact-form button:hover {
    background-color: #5847b6;
}

/* Footer */
footer {
    background-color: var(--primary);
    color: var(--text-light);
    text-align: center;
    padding: 1rem 0;
}

footer p {
    font-size: 0.9rem;
}

/* Responsive design */
@media (max-width: 768px) {
    /* Prevent horizontal scroll */
    body, html {
        overflow-x: hidden;
        width: 100%;
    }
    
    /* Header adjustments */
    header .container {
        position: relative;
        padding: 1rem 20px;
    }
    
    /* Navigation menu */
    nav ul {
        position: fixed;
        top: 70px; /* Adjust based on header height */
        right: -100%; /* Start off-screen */
        background-color: var(--primary);
        flex-direction: column;
        width: 250px;
        height: auto;
        text-align: left;
        padding: 2rem 1rem;
        box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
        transition: right 0.3s ease;
        z-index: 999;
        border-radius: 0 0 0 10px;
        margin: 0;
    }
    
    nav ul.active {
        right: 0; /* Slide in from right */
    }
    
    nav ul li {
        margin-bottom: 1.5rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding-bottom: 0.5rem;
    }
    
    nav ul li:last-child {
        border-bottom: none;
    }
    
    nav a {
        display: block;
        padding: 0.5rem 0;
        font-size: 1.1rem;
    }
    
    /* Mobile menu toggle */
    .menu-toggle {
        display: flex;
        z-index: 1000;
    }
    
    .menu-toggle.active .bar:nth-child(1) {
        transform: translateY(8px) rotate(45deg);
    }
    
    .menu-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }
    
    .menu-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    /* Hero section adjustments */
    .hero {
        height: 100vh;
        background-position: center;
    }
    
    .hero-content {
        padding: 0 20px;
        text-align: center;
    }
    
    .hero h2 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .hero p {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    /* About section */
    .about-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-image img {
        width: 100%;
        height: auto;
    }
    
    /* Services section */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Projects section */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .project-card img {
        width: 100%;
        height: auto;
    }
    
    /* Contact section */
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* General text adjustments */
    h2 {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    p {
        font-size: 1rem;
        line-height: 1.6;
    }
}

/* Extra small devices (phones, 480px and down) */
@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    header .container {
        padding: 1rem 15px;
    }
    
    .hero-content {
        padding: 0 15px;
    }
    
    .hero h2 {
        font-size: 1.8rem;
    }
    
    .hero p {
        font-size: 0.95rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
    nav ul {
        width: 100%;
        right: -100%;
        top: 60px;
    }
    
    .menu-toggle .bar {
        width: 22px;
        height: 2px;
    }
    
    .logo {
        font-size: 1.4rem;
    }
}

/* Performance optimizations for images */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Optimize hero background loading */
.hero {
    background-color: var(--primary); /* Fallback color while image loads */
}

.hero.loading {
    background-color: var(--primary);
}

.hero.loaded {
    background-image: url('images/hero.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Smooth transitions for better UX */
* {
    transition: all 0.3s ease;
}

/* Optimize animations for better performance */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}