/* Mobile Navigation */
@media (max-width: 768px) {
    .nav-container {
        padding: 0.5rem 1rem;
    }

    .logo-container {
        gap: 0.5rem;
    }

    .profile-image {
        width: 50px;
        height: 50px;
        min-width: 50px;
        border-radius: 50%;
        overflow: hidden;
        aspect-ratio: 1/1;
    }

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

    .logo {
        font-size: 1.2rem;
    }

    .nav-links {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: flex !important;
        position: absolute;
        top: 1.2rem;
        right: 1.2rem;
        z-index: 1100;
        background: transparent;
        border: none;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 40px;
        height: 40px;
        cursor: pointer;
    }

    .mobile-menu-toggle span {
        display: block;
        width: 28px;
        height: 3px;
        margin: 4px 0;
        background: var(--primary-color);
        border-radius: 2px;
        transition: all 0.3s;
    }

    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.7);
        z-index: 1200;
        justify-content: center;
        align-items: center;
    }

    .mobile-menu-overlay.active {
        display: flex;
    }

    .mobile-menu {
        background: var(--card-bg);
        border-radius: 20px;
        box-shadow: 0 8px 32px rgba(0,0,0,0.2);
        padding: 2rem 2.5rem;
        display: flex;
        flex-direction: column;
        gap: 2rem;
        align-items: center;
        min-width: 220px;
    }

    .mobile-menu a {
        color: var(--primary-color);
        font-size: 1.2rem;
        text-decoration: none;
        font-weight: 600;
        transition: color 0.2s;
    }

    .mobile-menu a:hover {
        color: var(--secondary-color);
    }

    .mobile-menu .close-menu {
        position: absolute;
        top: 1.5rem;
        right: 2rem;
        font-size: 2rem;
        color: var(--primary-color);
        background: none;
        border: none;
        cursor: pointer;
    }

    /* Hero Section */
    .hero-section {
        background-image: url('../images/KOI.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        min-height: 50vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        position: relative;
        color: white;
        filter: brightness(1.1);
    }

    .hero-content {
        flex-direction: column-reverse;
        align-items: center;
        gap: 1.2rem;
        padding: 0;
        text-align: center;
        width: 100%;
    }

    .hero-text {
        text-align: center;
        width: 100%;
        margin: 0 auto;
    }

    .hero-image {
        flex: none;
        width: 120px;
        height: 120px;
        margin: 0 auto 1rem auto;
        border-radius: 50%;
        border: 3px solid rgba(255,255,255,0.3);
        box-shadow: 0 2px 10px rgba(0,0,0,0.15);
        overflow: hidden;
        position: relative;
        background: var(--card-bg);
    }

    .hero-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
        display: block;
    }

    .hero-text h1 {
        font-size: 2rem;
        margin-bottom: 0.5rem;
        line-height: 1.2;
    }

    .hero-text p {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    /* Quick Links */
    .quick-links {
        padding: 2rem 0.5rem;
    }

    /* Credentials */
    .credentials {
        padding: 2rem 0.5rem;
    }

    .credentials h2 {
        font-size: 1.5rem;
    }

    .credentials .logos {
        gap: 1rem;
    }

    .credentials img {
        height: 40px;
    }

    /* Publications Carousel */
    .publications-carousel {
        padding: 2rem 0;
    }

    .publications-carousel .carousel-header {
        flex-direction: row;
        align-items: center;
        padding: 0 1rem;
    }

    .publications-carousel .carousel-header h2 {
        font-size: 1.2rem;
    }

    .carousel-track .book-card {
        flex: 0 0 180px;
    }

    .book-card img {
        height: 180px;
    }

    .book-info h3 {
        font-size: 1rem;
    }

    /* Studio Carousel */
    .studio-carousel {
        padding: 2rem 0;
    }

    .studio-carousel .carousel-header h2 {
        font-size: 1.2rem;
    }

    .studio-carousel .carousel-container {
        height: 180px;
        margin: 0 0.5rem;
    }

    /* Books Carousel */
    .books-carousel {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 1rem;
    }

    .book-card {
        max-width: 200px;
        margin: 0 auto;
    }

    /* Contact Form */
    .contact-container {
        grid-template-columns: 1fr;
        gap: 1.2rem;
        padding: 1rem;
    }

    .contact-info, .contact-form {
        padding: 1rem;
    }

    /* Biography Page */
    .biography-container {
        padding: 1rem;
    }

    .bio-section {
        padding: 1.5rem;
    }

    .bio-image {
        width: 200px;
        height: 200px;
        margin: 0 auto 1.5rem;
        border-radius: 50%;
        aspect-ratio: 1/1;
    }

    .bio-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
    }

    .timeline-item {
        padding-left: 2rem;
    }

    .timeline-date {
        font-size: 1rem;
    }

    /* Publications Grid */
    .publications-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 1rem;
    }

    /* Toast Notifications */
    .toast {
        width: calc(100% - 2rem);
        right: 1rem;
        min-width: auto;
    }

    /* Form Elements */
    .form-group {
        margin-bottom: 1.2rem;
    }

    input, select, textarea {
        padding: 0.8rem;
    }

    /* Footer */
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        padding: 1rem 0.5rem;
    }

    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
    }

    main {
        margin-bottom: 60px; /* Spazio per il menu mobile */
    }

    .theme-toggle-container {
        bottom: 70px; /* Sopra il menu mobile */
        right: 1rem;
    }

    .scroll-top {
        bottom: 70px;
        right: 1rem;
    }

    /* Dark mode fix */
    [data-theme="dark"] .hero-section {
        background-image: url('../images/KOI.png');
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        min-height: 50vh;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-align: center;
        position: relative;
        color: white;
        filter: brightness(0.8);
    }

    [data-theme="dark"] .hero-image {
        background: var(--card-bg);
        border: 3px solid var(--primary-color);
    }

    [data-theme="dark"] .quick-link-card,
    [data-theme="dark"] .book-card {
        background: var(--card-bg);
        color: var(--text-color);
    }

    [data-theme="dark"] .nav-links {
        background: var(--nav-bg);
        border-top: 1px solid var(--primary-color);
    }

    [data-theme="dark"] .nav-links a {
        color: #fff;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    .nav-links {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--card-bg);
        padding: 0.5rem;
        display: flex;
        justify-content: space-around;
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 1000;
    }

    .nav-links a {
        font-size: 0.8rem;
        text-align: center;
        padding: 0.5rem;
    }

    main {
        margin-bottom: 60px; /* Spazio per il menu mobile */
    }

    .hero-text h1 {
        font-size: 2rem;
    }

    .hero-text p {
        font-size: 1rem;
    }

    .credentials .logos {
        gap: 1.5rem;
    }

    .credentials img {
        height: 50px;
    }

    /* Adjust theme toggle and scroll top buttons */
    .theme-toggle-container {
        bottom: 70px; /* Above mobile nav */
    }

    .scroll-top {
        bottom: 70px; /* Above mobile nav */
    }
}

/* Landscape Mode */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-content {
        flex-direction: row;
        padding: 1rem;
    }

    .hero-image {
        flex: 0 0 150px;
        height: 150px;
    }
}

/* Tablet Styles */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-section {
        padding: 3rem 2rem;
        gap: 3rem;
    }

    .books-carousel {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
        padding: 2rem;
    }

    .contact-container {
        grid-template-columns: 1fr;
        max-width: 700px;
        margin: 0 auto;
    }

    .publications-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Ensure proper aspect ratio for all images */
img {
    max-width: 100%;
    height: auto;
}

/* Fix for image distortion */
.profile-image, .hero-image, .bio-image {
    position: relative;
    overflow: hidden;
}

.profile-image::after, .hero-image::after, .bio-image::after {
    content: '';
    display: block;
    padding-bottom: 100%;
}

.profile-image img, .hero-image img, .bio-image img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

@media (min-width: 769px) {
    .mobile-menu-toggle {
        display: none !important;
    }
    .mobile-menu-overlay {
        display: none !important;
    }
} 