/* Amine Z. Portfolio - Main Stylesheet */

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

html {
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: #ffffff;
    overflow-x: hidden;
    background: #000000;
    cursor: none;
    scroll-snap-type: y mandatory;
}

/* Custom Cursor */
.cursor {
    position: fixed;
    width: 20px;
    height: 20px;
    background: #ffffff;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transition: transform 0.1s ease;
    mix-blend-mode: difference;
}

.cursor.hover {
    transform: scale(2);
}

/* Navigation - Hamburger Menu */
.hamburger-menu {
    position: fixed;
    top: 3rem;
    right: 3rem;
    z-index: 1001;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.hamburger-line {
    width: 30px;
    height: 2px;
    background: #ffffff;
    transition: all 0.3s ease;
    transform-origin: center;
}

.hamburger-menu.open .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-menu.open .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.open .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(8px, -8px);
}

/* Menu Overlay */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.98);
    backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
}

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

.menu-content {
    text-align: center;
    transform: translateY(50px);
    transition: transform 0.4s ease;
}

.menu-overlay.open .menu-content {
    transform: translateY(0);
}

.menu-links {
    list-style: none;
    margin: 0;
    padding: 0;
    margin-bottom: 3rem;
}

.menu-links li {
    margin: 2rem 0;
}

.menu-links a {
    color: #ffffff;
    text-decoration: none;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    transition: all 0.3s ease;
    display: block;
    position: relative;
}

.menu-links a::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: #ffffff;
    transition: width 0.3s ease;
}

.menu-links a:hover::after {
    width: 100%;
}

.menu-links a:hover {
    transform: scale(1.05);
}

/* Language Switcher in Menu */
.menu-language-switcher {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: center;
}

.menu-lang-toggle {
    background: transparent;
    border: 2px solid #ffffff;
    color: #ffffff;
    padding: 1rem 2rem;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.menu-lang-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #ffffff;
    transition: left 0.3s ease;
    z-index: -1;
}

.menu-lang-toggle:hover::before {
    left: 0;
}

.menu-lang-toggle:hover {
    color: #000000;
}

.menu-lang-toggle.active {
    background: #ffffff;
    color: #000000;
}

.menu-lang-divider {
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.5rem;
}

/* Sections - Full Page Scrolling */
section {
    min-height: 100vh;
    height: 100vh;
    padding: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    scroll-snap-align: start;
}

.container {
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Hero Section */
.hero {
    text-align: center;
    color: white;
    position: relative;
}

.hero-content {
    animation: fadeInUp 1s ease;
    z-index: 2;
    max-width: 1000px;
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 8rem);
    font-weight: 900;
    margin-bottom: 2rem;
    letter-spacing: -0.04em;
    line-height: 0.9;
    opacity: 0;
    animation: titleReveal 2s ease forwards 0.5s;
}

.hero .subtitle {
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: 300;
    margin-bottom: 3rem;
    opacity: 0;
    letter-spacing: 0.1em;
    animation: subtitleReveal 1.5s ease forwards 1.5s;
}

.cta-button {
    display: inline-block;
    padding: 1.2rem 3rem;
    background: transparent;
    color: #ffffff;
    text-decoration: none;
    border: 2px solid #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    transition: all 0.4s ease;
    opacity: 0;
    animation: buttonReveal 1s ease forwards 2.5s;
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #ffffff;
    transition: left 0.4s ease;
    z-index: -1;
}

.cta-button:hover::before {
    left: 0;
}

.cta-button:hover {
    color: #000000;
    transform: translateY(-3px);
}

/* Geometric Background */
.geometric-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.geo-shape {
    position: absolute;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: geometricFloat 8s ease-in-out infinite;
}

.geo-shape:nth-child(1) {
    width: 200px;
    height: 200px;
    top: 20%;
    left: 10%;
    animation-delay: 0s;
    transform: rotate(45deg);
}

.geo-shape:nth-child(2) {
    width: 150px;
    height: 150px;
    top: 60%;
    right: 15%;
    animation-delay: 2s;
    border-radius: 50%;
}

.geo-shape:nth-child(3) {
    width: 100px;
    height: 100px;
    bottom: 30%;
    left: 20%;
    animation-delay: 4s;
    clip-path: polygon(50% 0%, 0% 100%, 100% 100%);
    border: none;
    background: rgba(255, 255, 255, 0.05);
}

/* Content Sections */
.content-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0;
    padding: 3rem;
    margin: 1rem 0;
    backdrop-filter: blur(20px);
    transform: translateY(100px);
    opacity: 0;
    transition: all 1s ease;
    position: relative;
    overflow: hidden;
    /* Ensure sections fit within viewport */
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
}

.content-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, #ffffff, transparent);
    transition: left 1s ease;
}

.content-section.visible::before {
    left: 100%;
}

.content-section.visible {
    transform: translateY(0);
    opacity: 1;
}

.section-title {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    margin-bottom: 2rem;
    text-align: center;
    letter-spacing: -0.02em;
    position: relative;
}

/* Typewriter Animation for Titles */
.typewriter {
    overflow: hidden;
    border-right: 3px solid #ffffff;
    white-space: nowrap;
    animation: typing 2s steps(20) forwards, blink 1s infinite;
}

/* About Section */
.about-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 4rem;
    align-items: center;
}

.about-image {
    width: 300px;
    height: 300px;
    border: 2px solid #ffffff;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    position: relative;
    transition: all 0.5s ease;
}

.about-image::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: -10px;
    bottom: -10px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    z-index: -1;
    transition: all 0.3s ease;
}

.about-image:hover::before {
    top: 20px;
    left: 20px;
    right: -20px;
    bottom: -20px;
}

.about-text {
    font-size: 1.1rem;
    line-height: 1.7;
    font-weight: 300;
}

.about-text p {
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: textReveal 1s ease forwards;
}

.about-text p:nth-child(2) { animation-delay: 0.3s; }
.about-text p:nth-child(3) { animation-delay: 0.6s; }

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.project-square {
    aspect-ratio: 3/2;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    text-align: left;
    padding: 1.5rem;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.project-square::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    transition: left 0.4s ease;
    z-index: -1;
}

.project-square:hover::before {
    left: 0;
}

.project-square:hover {
    transform: translateY(-10px) scale(1.02);
    border-color: #ffffff;
    box-shadow: 0 20px 40px rgba(255, 255, 255, 0.1);
}

.project-number {
    font-size: 2.5rem;
    font-weight: 900;
    opacity: 0.3;
    transition: all 0.3s ease;
    margin-right: 1rem;
    flex-shrink: 0;
}

.project-square:hover .project-number {
    opacity: 1;
    transform: scale(1.1);
}

.project-title {
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    line-height: 1.3;
    flex: 1;
}

/* Project Modal */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(20px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    padding: 2rem;
}

.project-modal.open {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    max-width: 1000px;
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    padding: 3rem;
    transform: translateY(50px);
    transition: transform 0.4s ease;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.project-modal.open .modal-content {
    transform: translateY(0);
}

.modal-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: transparent;
    border: 2px solid #ffffff;
    color: #ffffff;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: #ffffff;
    color: #000000;
    transform: rotate(90deg);
}

/* Demo Header - Titre et bouton sur la même ligne */
.demo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* Demo Close Button - Noir avec contour rouge, devient rouge au hover */
.demo-close-btn {
    background: #000000;
    border: 2px solid #ff4444;
    color: #ff4444;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0;
    box-shadow: 0 2px 10px rgba(255, 68, 68, 0.3);
    flex-shrink: 0;
    margin-left: 1rem;
}

.demo-close-btn:hover {
    background: #ff4444;
    border-color: #ff4444;
    color: #ffffff;
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 4px 15px rgba(255, 68, 68, 0.5);
}

/* Demo Button - Green color */
#modalDemoBtn {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: #ffffff !important;
}

#modalDemoBtn:hover {
    background: #34ce57 !important;
    border-color: #34ce57 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}

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

.modal-image {
    width: 100%;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.5);
    overflow: hidden;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-info h3 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #ffffff;
}

.modal-info p {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
    color: rgba(255, 255, 255, 0.8);
}

.modal-technologies {
    margin-bottom: 2rem;
}

.modal-technologies h4 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.7);
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.modal-links {
    display: flex;
    gap: 1rem;
}

.modal-link {
    padding: 1rem 2rem;
    background: transparent;
    color: #ffffff;
    text-decoration: none;
    border: 2px solid #ffffff;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.modal-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #ffffff;
    transition: left 0.3s ease;
    z-index: -1;
}

.modal-link:hover::before {
    left: 0;
}

.modal-link:hover {
    color: #000000;
}

/* Contact Section */
.contact-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.contact-content p {
    font-size: 1.1rem;
    font-weight: 300;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* Contact Info */
.contact-info {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    margin: 2rem 0;
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
}

.contact-item:hover {
    transform: translateY(-3px);
}

.contact-icon {
    font-size: 1.5rem;
    opacity: 0.8;
}

.contact-value {
    font-size: 1rem;
    font-weight: 400;
    color: #ffffff;
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: all 0.3s ease;
    border-bottom: 1px solid transparent;
}

.contact-value:hover {
    color: rgba(255, 255, 255, 0.8);
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.contact-divider {
    width: 1px;
    height: 30px;
    background: rgba(255, 255, 255, 0.2);
}

/* Contact Form */
.contact-form {
    display: grid;
    gap: 1.5rem;
    text-align: left;
    margin-top: 2rem;
}

.form-group {
    position: relative;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 1.2rem;
    background: transparent;
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 300;
    transition: all 0.3s ease;
    resize: none;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: rgba(255, 255, 255, 0.5);
    transition: opacity 0.3s ease;
}

.form-input:focus::placeholder,
.form-textarea:focus::placeholder {
    opacity: 0;
}

.form-textarea {
    min-height: 120px;
    max-height: 200px;
}

.form-label {
    position: absolute;
    top: -10px;
    left: 15px;
    background: #000000;
    padding: 0 10px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.form-input:focus + .form-label,
.form-textarea:focus + .form-label {
    color: #ffffff;
}

.submit-button {
    justify-self: center;
    padding: 1.2rem 2.5rem;
    background: transparent;
    color: #ffffff;
    border: 2px solid #ffffff;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: all 0.4s ease;
    position: relative;
    overflow: hidden;
    margin-top: 0.5rem;
}

.submit-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: #ffffff;
    transition: left 0.4s ease;
    z-index: -1;
}

.submit-button:hover::before {
    left: 0;
}

.submit-button:hover {
    color: #000000;
    transform: translateY(-3px);
}

.submit-button:active {
    transform: translateY(-1px);
}

/* Form Animation */
.form-group {
    opacity: 0;
    transform: translateY(30px);
    animation: formReveal 0.8s ease forwards;
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }

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

/* Animations */
@keyframes titleReveal {
    from {
        opacity: 0;
        transform: translateY(100px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes geometricFloat {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
    }
    25% {
        transform: translateY(-20px) rotate(90deg);
    }
    50% {
        transform: translateY(-10px) rotate(180deg);
    }
    75% {
        transform: translateY(-30px) rotate(270deg);
    }
}

@keyframes textReveal {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes typing {
    from {
        width: 0;
    }
    to {
        width: 100%;
    }
}

@keyframes blink {
    0%, 50% {
        border-color: #ffffff;
    }
    51%, 100% {
        border-color: transparent;
    }
}

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

/* Mouse Trail Effect */
.trail {
    position: fixed;
    width: 4px;
    height: 4px;
    background: #ffffff;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 2rem;
    }

    .about-image {
        width: 200px;
        height: 200px;
        font-size: 3rem;
        margin: 0 auto;
    }

    .about-text {
        font-size: 1rem;
        line-height: 1.6;
    }

    .about-text p {
        margin-bottom: 1.2rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .hamburger-menu {
        top: 2rem;
        right: 2rem;
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .project-square {
        padding: 1rem;
        aspect-ratio: 2.5/1; /* Even more rectangular for tablet */
    }

    .project-number {
        font-size: 2rem;
        margin-right: 0.8rem;
    }

    .project-title {
        font-size: 0.85rem;
        line-height: 1.2;
    }

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

    .modal-content {
        padding: 2rem;
    }
}

@media (max-width: 768px) {
    body {
        cursor: auto;
    }

    .cursor, .trail {
        display: none;
    }

    section {
        padding: 1rem;
        overflow: hidden; /* Critical: prevent any internal scrolling */
    }

    .hamburger-menu {
        top: 1.5rem;
        right: 1.5rem;
    }

    .menu-links a {
        font-size: 2rem;
    }

    .menu-lang-toggle {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Mobile About Section - Larger fonts with better space usage */
    .about-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.5rem;
    }

    .about-image {
        width: 150px;
        height: 150px;
        font-size: 2.5rem;
        margin: 0 auto;
    }

    .about-text {
        font-size: 1rem;
        line-height: 1.5;
    }

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

    /* Mobile Contact Section - More compact to fit on screen */
    .contact-content p {
        font-size: 0.9rem;
        margin-bottom: 0.8rem;
        line-height: 1.4;
    }

    .contact-info {
        gap: 0.8rem;
        margin: 0.8rem 0;
        padding: 0.8rem 0;
    }

    .contact-item {
        font-size: 0.85rem;
    }

    .contact-icon {
        font-size: 1.1rem;
    }

    .contact-form {
        gap: 0.8rem;
        margin-top: 0.8rem;
    }

    .form-input,
    .form-textarea {
        padding: 0.9rem;
        font-size: 0.85rem;
    }

    .form-textarea {
        min-height: 80px;
        max-height: 120px;
    }

    .submit-button {
        padding: 0.9rem 1.8rem;
        font-size: 0.85rem;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }

    .contact-info {
        flex-direction: column;
        gap: 0.8rem;
        text-align: center;
    }

    .contact-divider {
        width: 80px;
        height: 1px;
        margin: 0 auto;
    }

    /* Mobile-optimized projects grid - Ultra compact to fit all 10 */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 0.4rem; /* Much smaller gaps */
        margin-top: 1rem;
    }

    .project-square {
        padding: 0.5rem 0.8rem; /* Much smaller padding */
        aspect-ratio: 6/1; /* Super wide rectangles */
        min-height: auto;
        border-width: 1px;
    }

    .project-number {
        font-size: 1.2rem; /* Smaller numbers */
        margin-right: 0.8rem;
        font-weight: 800;
        min-width: 30px;
    }

    .project-title {
        font-size: 0.7rem; /* Smaller text */
        line-height: 1.1;
        text-align: left;
        letter-spacing: 0.01em;
        max-width: 100%;
        overflow-wrap: break-word;
    }

    /* Make content sections more compact to fit contact form */
    .content-section {
        padding: 0.8rem 0.8rem; /* Reduced padding for more space */
        margin: 0;
        max-height: calc(100vh - 1.6rem); /* Reduced height limit */
        overflow: hidden; /* No internal scrolling */
    }

    .section-title {
        font-size: clamp(1.6rem, 5vw, 2.2rem);
        margin-bottom: 0.8rem; /* Reduced margin */
    }

    .modal-close {
        top: 1rem;
        right: 1rem;
        width: 30px;
        height: 30px;
        font-size: 1.2rem;
    }

    .modal-info h3 {
        font-size: 1.5rem;
    }

    .modal-links {
        flex-direction: column;
    }

    .modal-link {
        text-align: center;
        padding: 0.8rem 1.5rem;
        font-size: 0.8rem;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .content-section {
        padding: 1.5rem 1rem;
    }

    section {
        padding: 0.8rem;
        overflow: hidden;
    }

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

    /* Very compact projects for small screens - All must fit on screen */
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 0.3rem; /* Minimal gaps */
        margin-top: 0.8rem;
    }

    .project-square {
        padding: 0.4rem 0.6rem; /* Minimal padding */
        aspect-ratio: 7/1; /* Ultra-wide rectangles */
        border-width: 1px;
    }

    .project-number {
        font-size: 1rem; /* Even smaller */
        margin-right: 0.6rem;
        font-weight: 800;
        min-width: 25px;
    }

    .project-title {
        font-size: 0.65rem; /* Very small but readable */
        line-height: 1.05;
        letter-spacing: 0.005em;
        max-width: 100%;
        overflow-wrap: break-word;
    }

    /* Ultra compact content sections to ensure everything fits */
    .content-section {
        padding: 0.6rem 0.6rem; /* Minimal padding */
        margin: 0;
        max-height: calc(100vh - 1.2rem); /* Very strict height limit */
        overflow: hidden;
    }

    /* Better space usage for About Section */
    .about-content {
        gap: 1rem;
    }

    .about-image {
        width: 130px;
        height: 130px;
        font-size: 2.2rem;
    }

    .about-text {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .about-text p {
        margin-bottom: 0.8rem;
    }

    /* Compact Contact Section for small screens */
    .contact-content p {
        font-size: 0.85rem;
        margin-bottom: 0.6rem;
        line-height: 1.3;
    }

    .contact-info {
        gap: 0.6rem;
        margin: 0.6rem 0;
        padding: 0.6rem 0;
    }

    .contact-item {
        font-size: 0.8rem;
    }

    .contact-icon {
        font-size: 1rem;
    }

    .contact-form {
        gap: 0.6rem;
        margin-top: 0.6rem;
    }

    .form-input,
    .form-textarea {
        padding: 0.7rem;
        font-size: 0.8rem;
    }

    .form-textarea {
        min-height: 70px;
        max-height: 100px;
    }

    .submit-button {
        padding: 0.7rem 1.5rem;
        font-size: 0.8rem;
        margin-top: 0.3rem;
    }

    .form-row {
        gap: 0.6rem;
    }

    .contact-divider {
        width: 60px;
    }

    .section-title {
        font-size: clamp(1.4rem, 4vw, 1.8rem);
        margin-bottom: 0.6rem;
    }

    /* Improve modal for very small screens */
    .modal-content {
        padding: 1rem;
        margin: 0.5rem;
        max-height: 90vh;
    }

    .modal-info h3 {
        font-size: 1.3rem;
        margin-bottom: 0.8rem;
    }

    .modal-info p {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 1.5rem;
    }

    .tech-tags {
        gap: 0.3rem;
    }

    .tech-tag {
        font-size: 0.7rem;
        padding: 0.4rem 0.8rem;
    }

    .modal-links {
        gap: 0.8rem;
    }

    .modal-link {
        padding: 0.7rem 1.2rem;
        font-size: 0.75rem;
    }

    .project-modal {
        padding: 1rem;
    }
}