/* =================================== */
/* REFINED MOBILE FIXES - VERSION 8 */
/* Replace mobile-fixes-complete-v7.css with this version */
/* =================================== */

/* Desktop - keep everything as is */
@media (min-width: 992px) {
    /* Credentials display inline on desktop */
    .credential-item,
    .affiliation-item,
    .separator {
        display: inline;
    }
}

/* Tablet (768px - 991px) */
@media (max-width: 991px) and (min-width: 769px) {
    
    /* Slightly larger headers */
    .sec-title p strong {
        font-size: 3.5rem !important;
    }
    
    /* Add breathing room */
    #publications .container,
    #contributions .container,
    #projects .container,
    #contact .container {
        padding-left: 25px;
        padding-right: 25px;
    }
    
    /* Keep credentials on one line for tablets */
    .credential-item,
    .affiliation-item,
    .separator {
        display: inline;
    }
    
    /* FIX: Background image for Experience section on tablet */
    #experience.parallax {
        background-size: cover !important;
        background-position: center center !important;
        background-attachment: scroll !important;
    }
    
    /* MATCH DESKTOP: Sky blue overlay at 78% opacity */
    #experience .overlay {
        background-color: rgba(135, 206, 235, 0.78) !important;
        padding: 70px 0 40px !important;
    }
    
    /* Increase body text size */
    body, p, li {
        font-size: 19px !important;
    }
    
    /* Larger text in Experience section */
    #experience .testimonial-item span {
        font-size: 2.1rem !important;
    }
    
    #experience .testimonial-item p {
        font-size: 1.9rem !important;
    }
}

/* Mobile screens (up to 768px) */
@media (max-width: 768px) {
    
    /* ==================== FIX: Hide main name on mobile (keep in nav) ==================== */
    
    .caption-content h2 {
        opacity: 0 !important; /* CHANGED: Hide the main name */
        font-size: 3rem !important;
        font-weight: 700 !important;
        margin-bottom: 50px !important;
        margin-top: 0 !important;
        height: 0 !important; /* ADDED: Remove space it takes up */
        overflow: hidden !important; /* ADDED: Ensure it takes no space */
        margin: 0 !important; /* ADDED: Remove all margins */
    }
    
    /* Move credentials up since name is hidden */
    .caption-content h3.credentials-line {
        font-size: 2rem !important;
        line-height: 1.6 !important;
        margin-bottom: 20px !important;
        margin-top: 0px !important; /* CHANGED: No top margin since name is hidden */
    }
    
    /* Keep affiliations line (Topical Editor) in its current position */
    .caption-content h4.affiliations-line {
        font-size: 1.6rem !important;
        line-height: 1.5 !important;
        margin-top: 0 !important;
    }
    
    /* Generic h3/h4 for backwards compatibility if classes aren't used */
    .caption-content h3 {
        font-size: 2rem !important;
        line-height: 1.6 !important;
        margin-bottom: 20px !important;
        margin-top: 0px !important; /* CHANGED: No extra margin */
    }
    
    .caption-content h4 {
        font-size: 1.6rem !important;
        line-height: 1.5 !important;
    }
    
    /* ==================== FIX 2: Each credential on its own line ==================== */
    
    /* Stack credentials vertically */
    .credentials-line,
    .affiliations-line {
        display: block;
        text-align: center;
    }
    
    .credential-item,
    .affiliation-item {
        display: block;
        margin: 8px 0;
    }
    
    /* Hide separator bars on mobile */
    .separator {
        display: none;
    }
    
    /* ==================== FIX 3: Photo centered, text below - LARGER (25% increase) ==================== */
    
    #about {
        padding-top: 50px;
    }
    
    #about .welcome-block {
        overflow: visible;
        display: block;
        text-align: center;
    }
    
    /* Photo first, centered, with good spacing below - 25% LARGER */
    #about .welcome-block img {
        float: none !important;
        display: block !important;
        margin: 0 auto 40px !important;
        max-width: 200px !important; /* CHANGED: 160px * 1.25 = 200px */
    }
    
    /* Text starts cleanly below photo */
    #about .message-body {
        clear: both !important;
        overflow: visible !important;
        margin-bottom: 30px !important;
        margin-top: 0 !important;
        text-align: left !important;
    }
    
    /* Increase body text size */
    #about .message-body p {
        margin-top: 0 !important;
        line-height: 1.8 !important;
        font-size: 1.9rem !important;
    }
    
    /* Ensure bullet points match body text size */
    #about .message-body ul li {
        font-size: 1.9rem !important;
        line-height: 1.8 !important;
    }
    
    /* ==================== FIX 4: Larger section headers ==================== */
    
    .sec-title p strong {
        font-size: 3rem !important;
        display: block;
    }
    
    /* FIX: Reduce width of underline under section headers */
    .sec-title h2:after {
        width: 80px !important;
        left: 50% !important;
        margin-left: -40px !important;
    }
    
    /* ==================== FIX 4b: Experience section - MORE spacing to prevent logo cutoff ==================== */
    
    /* INCREASED space after section header before logos - prevents cutoff */
    #experience .sec-title {
        margin-bottom: 110px !important;
    }
    
    /* Add more padding to testimonial container to prevent cutoff */
    #testimonial {
        padding-top: 50px !important;
        position: relative !important;
        z-index: 10 !important;
    }
    
    /* Ensure testimonial items are above overlay with MORE room */
    .testimonial-item {
        position: relative !important;
        z-index: 15 !important;
        padding-top: 20px !important;
    }
    
    /* Make sure images have room at top */
    .testimonial-item img {
        margin-top: 10px !important;
    }
    
    /* Center navigation arrows with reduced width */
    #experience .owl-buttons,
    #testimonial .owl-buttons,
    .owl-buttons {
        float: none !important;
        display: inline-block !important;
        text-align: center;
        margin: 25px auto;
        clear: both;
        width: auto;
        padding: 1px 12px 5px;
        position: relative !important;
        z-index: 20 !important;
    }
    
    /* Center the arrows container */
    #experience .row,
    #testimonial .row {
        text-align: center;
    }
    
    /* ==================== FIX 4c: Experience overlay - EXACT MATCH TO DESKTOP ==================== */
    
    #experience.parallax {
        background-size: cover !important;
        background-position: center center !important;
        background-attachment: scroll !important;
    }
    
    /* EXACT DESKTOP MATCH: Sky blue overlay rgba(135, 206, 235, 0.78) */
    #experience .overlay {
        background-color: rgba(135, 206, 235, 0.78) !important;
        padding: 70px 0 40px !important;
        position: relative !important;
        z-index: 5 !important;
    }
    
    /* Ensure overlay covers entire section */
    #experience {
        position: relative !important;
        overflow: visible !important;
    }
    
    /* ==================== FIX 4d: LARGER text in Experience section ==================== */
    
    .testimonial-item span {
        font-size: 2.3rem !important;
        display: block;
        margin-bottom: 10px;
    }
    
    .testimonial-item p {
        font-size: 2.2 rem !important;
        line-height: 1.5;
    }
    
    /* ==================== FIX 5: LARGER accordion section headers (subheaders) ==================== */
    
    .accordion-header h3,
    .accordion-header h4 {
        font-size: 2rem !important;
        line-height: 1.4;
        font-weight: 600 !important;
    }
    
    /* ==================== White space on content sides ==================== */
    
    #publications .container,
    #contributions .container,
    #projects .container {
        padding-left: 20px;
        padding-right: 20px;
        max-width: 100%;
    }
    
    /* Contact section text 90% width */
    #contact .container {
        padding-left: 5%;
        padding-right: 5%;
        max-width: 100%;
    }
    
    #contact .sec-title p {
        max-width: 90%;
        margin-left: auto;
        margin-right: auto;
    }
    
    .project-wrapper {
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .accordion-container {
        padding-left: 0;
        padding-right: 0;
    }
    
    .accordion-content-inner {
        padding: 20px 15px;
    }
    
    /* Portfolio items responsive */
    .portfolio-item {
        width: 48%;
        margin: 0 1% 2% 1%;
    }
    
    /* ==================== Footer background ==================== */
    
    #social.parallax {
        background-size: cover !important;
        background-position: center center !important;
        background-attachment: scroll !important;
    }
    
    #social .overlay {
        background-color: rgba(0, 0, 0, 0.5);
        padding: 40px 0;
    }
    
    /* ==================== General text size increase ==================== */
    
    body, p, li, span {
        font-size: 19px !important;
    }
    
    /* ==================== Additional mobile refinements ==================== */
    
    .testimonial-item img {
        max-width: 200px;
        height: auto;
        margin: 0 auto 20px;
    }
    
    /* Ensure proper spacing */
    main > section {
        padding: 50px 0;
    }
}

/* Small mobile screens (up to 480px) */
@media (max-width: 480px) {
    
    /* ==================== Name still hidden on small screens ==================== */
    
    .caption-content h2 {
        opacity: 0 !important;
        font-size: 2.4rem !important;
        margin: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    .caption-content h3.credentials-line,
    .caption-content h3 {
        font-size: 1.6rem !important;
        margin-top: 0px !important; /* No margin since name hidden */
    }
    
    .caption-content h4 {
        font-size: 1.3rem !important;
    }
    
    /* ==================== Photo still larger on small screens ==================== */
    
    #about .welcome-block img {
        float: none !important;
        display: block !important;
        margin: 0 auto 35px !important;
        max-width: 175px !important; /* CHANGED: 140px * 1.25 = 175px */
    }
    
    #about .message-body {
        text-align: left !important;
        margin-top: 0 !important;
    }
    
    #about .message-body p,
    #about .message-body ul li {
        font-size: 1.7rem !important;
    }
    
    /* ==================== Smaller section headers ==================== */
    
    .sec-title p strong {
        font-size: 2.4rem !important;
    }
    
    .sec-title h2:after {
        width: 60px !important;
        margin-left: -30px !important;
    }
    
    /* Accordion headers still larger/readable on small screens */
    .accordion-header h3,
    .accordion-header h4 {
        font-size: 1.7rem !important;
    }
    
    /* Experience section spacing on small screens - still prevent cutoff */
    #experience .sec-title {
        margin-bottom: 100px !important;
    }
    
    #testimonial {
        padding-top: 40px !important;
    }
    
    .testimonial-item {
        padding-top: 15px !important;
    }
    
    /* ==================== Experience text still readable on small screens ==================== */
    
    .testimonial-item span {
        font-size: 2.0 rem !important;
    }
    
    .testimonial-item p {
        font-size: 1.9rem !important;
    }
    
    /* ==================== Tighter spacing ==================== */
    
    #publications .container,
    #contributions .container,
    #projects .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    #contact .container {
        padding-left: 5%;
        padding-right: 5%;
    }
    
    .accordion-content-inner {
        padding: 15px 10px;
    }
    
    /* ==================== Full-width portfolio on tiny screens ==================== */
    
    .portfolio-item {
        width: 100%;
        margin: 0 0 3% 0;
    }
    
    /* ==================== Smaller experience logos ==================== */
    
    .testimonial-item img {
        max-width: 150px;
    }
    
    /* ==================== Credentials ==================== */
    
    .credential-item,
    .affiliation-item {
        margin: 5px 0;
        font-size: 1.5rem;
    }
    
    /* ==================== Narrower nav arrows on small screens ==================== */
    
    .owl-buttons {
        padding: 1px 8px 5px !important;
    }
    
    /* General text */
    body, p, li, span {
        font-size: 17px !important;
    }
    
    main > section {
        padding: 40px 0;
    }
}

/* ==================== Landscape phone orientation ==================== */
@media (max-width: 768px) and (orientation: landscape) {
    
    /* Name still hidden in landscape */
    .caption-content h2 {
        opacity: 0 !important;
        margin: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
    }
    
    .caption-content h3 {
        font-size: 1.7rem !important;
        margin-top: 0px !important;
    }
    
    .caption-content h4 {
        font-size: 1.4rem !important;
    }
    
    .credential-item,
    .affiliation-item {
        margin: 5px 0;
    }
    
    #about .message-body {
        margin-top: 0 !important;
    }
    
    #about .message-body p,
    #about .message-body ul li {
        font-size: 1.7rem !important;
    }
    
    /* Photo larger in landscape too */
    #about .welcome-block img {
        max-width: 190px !important;
    }
    
    .accordion-header h3,
    .accordion-header h4 {
        font-size: 1.8rem !important;
    }
    
    /* Experience text in landscape */
    .testimonial-item span {
        font-size: 1.9rem !important;
    }
    
    .testimonial-item p {
        font-size: 1.7rem !important;
    }
}