/* 
* Responsive stylesheet for Didier Merk's academic resume website
* Contains all media queries for responsive design
* Version: 1.0
*/

/* Large Devices (Desktops, less than 1200px) */
@media (max-width: 1199.98px) {
    h1 {
        font-size: 3rem;
    }
    
    h2 {
        font-size: 2.2rem;
    }
    
    .profile-img-container,
    .profile-backdrop {
        width: 280px;
        height: 280px;
    }
    
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
    }

    .circles-composition{
        position:relative;          /* allows the translate to work */
        margin:0 auto;              /* keep the group in the middle of its grid column */
        transform:translateX(30px); /* half of the 20 px offset                       */
    }
}

/* Large Devices (Desktops, less than 1200px) */
@media (max-width: 1080px) {
    .circles-composition{
        position:relative;          /* allows the translate to work */
        margin:0 auto;              /* keep the group in the middle of its grid column */
        transform:translateX(30px); /* half of the 20 px offset                       */
    }
}

/* Medium Devices (Tablets, less than 992px) */
@media (max-width: 1199.98px) {
    .container {
        max-width: 1080px;
    }
    
    h1 {
        font-size: 2.8rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .hero-text {
        order: 2;
    }
    
    .hero-image {
        order: 1;
        margin-bottom: 2rem;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .profile-img-container,
    .profile-backdrop {
        width: 250px;
        height: 250px;
    }

    .about-cards {
        margin-top: 0; /* Reset margin on smaller screens */
    }
    
    .about-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .about-left {
        padding-right: 0;
    }
    
    .about-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.5rem;
    }
    
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .section-title {
        text-align: center;
    }
    
    .section-title::after {
        left: 50%;
        transform: translateX(-50%);
    }
}

/* Small Devices (Landscape Phones, less than 768px) */
@media (max-width: 767.98px) {
    .container {
        max-width: 767px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }
    
     /* Mobile Navigation - NEW STYLES */
     .nav-container {
        display: grid;
        grid-template-columns: auto 1fr auto;
        align-items: center;
        gap: 0.5rem;
    }
    
    .nav-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--text-primary);
        width: 40px; /* Fixed width to prevent layout shifts */
        height: 40px; /* Fixed height */
        cursor: pointer;
        z-index: 1000;
    }

    /* Hamburger animation */
    .nav-toggle.active .hamburger span:nth-child(1) {
        transform: translateY(9px) rotate(45deg);
    }

    .nav-toggle.active .hamburger span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .hamburger span:nth-child(3) {
        transform: translateY(-9px) rotate(-45deg);
    }
    
    .logo {
        justify-self: center;
        text-align: center;
    }
    
    .mobile-theme-toggle {
        display: flex;
        justify-self: end;
    }
    
    .nav-links {
        position: absolute;
        top: 70px; /* Height of the header */
        left: 0;
        width: 100%;
        max-height: 0;
        background-color: var(--card-bg);
        overflow: hidden;
        flex-direction: column;
        align-items: center;
        transition: max-height 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
        z-index: 998;
        padding: 0;
        box-shadow: none;
        margin-top: -1px; /* This negative margin eliminates the gap */
    }
    
    .nav-links.show {
        max-height: 300px; /* Adjust based on content */
        padding: 1rem 0;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    }
    
    .nav-links li {
        margin: 0.75rem 0;
        opacity: 0;
        transform: translateY(-10px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }
    
    .nav-links.show li {
        opacity: 1;
        transform: translateY(0);
    }
    
    .nav-links.show li:nth-child(1) { transition-delay: 0.05s; }
    .nav-links.show li:nth-child(2) { transition-delay: 0.1s; }
    .nav-links.show li:nth-child(3) { transition-delay: 0.15s; }
    .nav-links.show li:nth-child(4) { transition-delay: 0.2s; }
    .nav-links.show li:nth-child(5) { transition-delay: 0.25s; }
    
    /* Hide desktop theme toggle in mobile view */
    .theme-toggle {
        display: none;
    }
    
    .about-right {
        grid-template-columns: 1fr;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .social-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .social-links li {
        margin: 0.5rem;
    }
    
    /* Simplify timeline for mobile */
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item {
        padding-left: 60px;
    }
    
    .timeline-dot {
        left: 13px;
        transform: none;
    }
    
    .timeline-date {
        margin-left: 0;
        text-align: left;
    }

    .timeline-header {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .timeline-logo {
        width: 45px;
        height: 45px;
        margin-top: 0.5rem;
        margin-left: 0;
    }
    
    .timeline-toggle {
        top: 5px;
        right: 5px;
    }
    
    .timeline-item[data-expanded="true"] .timeline-expandable {
        max-height: 600px; /* Allow more height on mobile */
    }
    
    .publication-links {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.75rem; /* Reduced from 0.75rem for tighter spacing */
    }
    
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .citation-modal-content {
        margin: 20% auto;
        width: 95%;
    }
    
    .bibtex-content {
        font-size: 0.75rem;
    }
    
    .citation-modal-footer {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .citation-modal-footer .btn {
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }
}

/* Extra Small Devices (Portrait Phones, less than 576px) */
@media (max-width: 575.98px) {
    .container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.6rem;
    }
    
    .hero {
        padding-top: 80px;
    }
    
    .profile-img-container,
    .profile-backdrop {
        width: 200px;
        height: 200px;
    }
    
    .profile-backdrop {
        top: 15px;
        left: 15px;
    }
    
    .scroll-indicator {
        bottom: 30px;
    }

    .tab-btn {
        padding: 0.6rem 0.5rem;
        font-size: 0.95rem;  /* Slightly reduced but still larger than original 0.85rem */
    }
    
    .tab-btn span {
        font-size: 0.9rem;  /* Slightly reduced but still larger than original 0.8rem */
    }
    
    .tab-btn i {
        font-size: 1.1rem;  /* Slightly reduced but still larger than original 1rem */
    }
    
    .timeline-content {
        padding: 1rem;
    }
    
    .timeline-header {
        padding-right: 35px;
        gap: 8px;
    }

    .timeline-role-info {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .timeline-logo {
        width: 40px;
        height: 40px;
        padding: 4px;
    }

    .timeline-toggle {
        top: 5px;
    }
    
    .publication-title {
        font-size: 1.2rem;
    }
    
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem; /* Reduced from 1rem */
        margin-bottom: 1rem;
    }
    
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 35px;
        height: 35px;
    }
}

/* Fix for Safari's backdrop-filter */
@supports not (backdrop-filter: blur(10px)) {
    header {
        background-color: var(--primary);
    }
    
    .light-mode header {
        background-color: var(--background);
    }
}

/* Print Styles */
@media print {
    header, 
    footer, 
    .back-to-top, 
    .scroll-indicator {
        display: none;
    }
    
    body {
        background-color: #fff;
        color: #000;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }
    
    section {
        padding: 1rem 0;
        page-break-inside: avoid;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
}