/* ========================================
   RESPONSIVE & MOBILE OPTIMIZATIONS
   ======================================== */

/* Tablet and below (max-width: 1024px) */
@media screen and (max-width: 1024px) {
    .header-grid {
        width: 95%;
        margin: 2% 2.5%;
        padding-top: 2rem;
        gap: 2rem 0.75rem;
    }

    .block {
        padding: 4% 8%;
        font-size: 0.95rem;
    }

    .portfolio-resume-header {
        font-size: 1.1rem;
    }
}

/* Mobile landscape and small tablets (max-width: 768px) */
@media screen and (max-width: 768px) {

    /* Grid adjustments */
    .header-grid {
        width: 96%;
        height: auto;
        margin: 2% 2%;
        padding-top: 1.5rem;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    .block {
        width: 100% !important;
        height: auto !important;
        padding: 6% 8%;
        margin-top: 0;
        font-size: 0.9rem;
    }

    /* Typography adjustments */
    .portfolio-resume-header {
        font-size: 1rem;
    }

    .block p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    .block ul li {
        font-size: 0.9rem;
    }

    /* Hero section */
    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-name {
        font-size: 2rem;
    }

    .hero-role {
        font-size: 1rem;
    }

    .hero-label {
        font-size: 0.85rem;
    }

    .hero-location {
        font-size: 0.85rem;
    }

    /* Navigation buttons */
    .hero-navigation {
        flex-wrap: wrap;
        gap: 0.75rem;
    }

    .nav-button {
        padding: 0.75rem 1.5rem;
        font-size: 0.9rem;
    }

    /* Profile picture */
    #pp {
        width: 150px;
        height: 150px;
    }

    /* Images */
    .captions img {
        max-width: 120px;
    }

    /* Whoami tabs - make them smaller on mobile */
    body.whoami-page .block:not(#b2) h3 {
        font-size: 0.85rem;
        padding: 0.5rem 1.5rem 0.6rem;
        top: -2.5rem;
        left: 1.5rem;
    }

    body.whoami-page .block:hover h3 {
        top: -2.75rem;
    }
}

/* Mobile portrait (max-width: 480px) */
@media screen and (max-width: 480px) {

    /* Top bar adjustments */
    .top-bar {
        padding: 0.5rem 1rem;
    }

    #yc-logo img {
        width: 40px;
        height: 40px;
    }

    /* Hide desktop menu, show burger */
    .top-bar-right .menu.narrow {
        display: none;
    }

    .burger-menu {
        display: flex;
    }

    /* Grid and blocks */
    .header-grid {
        width: 94%;
        margin: 1rem auto;
        padding-top: 1rem;
        gap: 1rem;
    }

    .block {
        padding: 5% 6%;
        border-radius: 30px;
        font-size: 0.85rem;
    }

    /* Typography */
    .portfolio-resume-header {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
    }

    .block p {
        font-size: 0.85rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }

    .block ul li {
        font-size: 0.85rem;
        padding-left: 1.5rem;
    }

    /* Hero section */
    .hero-content {
        flex-direction: column;
        text-align: center;
    }

    .hero-name {
        font-size: 1.75rem;
    }

    .hero-role {
        font-size: 0.9rem;
    }

    .hero-label,
    .hero-location {
        font-size: 0.8rem;
    }

    .hero-logo {
        max-width: 200px;
        margin-top: 1rem;
    }

    /* Navigation */
    .hero-navigation {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
    }

    .nav-button {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 0.85rem;
    }

    /* Profile picture */
    #pp {
        width: 120px;
        height: 120px;
    }

    /* Images */
    .captions img {
        max-width: 100px;
    }

    /* Page titles */
    #page-title {
        font-size: 1.5rem;
        padding: 1rem;
    }

    /* Buttons */
    .button {
        font-size: 0.85rem;
        padding: 0.75rem 1.25rem;
    }

    /* Footer */
    footer {
        padding: 1rem;
        font-size: 0.8rem;
    }

    footer h5 {
        font-size: 0.85rem;
    }

    /* Whoami tabs - even smaller on small mobile */
    body.whoami-page .block:not(#b2) h3 {
        font-size: 0.75rem;
        padding: 0.4rem 1rem 0.5rem;
        top: -2.25rem;
        left: 1rem;
        letter-spacing: 0.08em;
    }

    body.whoami-page .block:hover h3 {
        top: -2.5rem;
    }

    /* Quote block */
    #quote blockquote p {
        font-size: 1.1rem;
    }

    #quote cite {
        font-size: 0.85rem;
    }
}

/* Very small mobile (max-width: 360px) */
@media screen and (max-width: 360px) {
    .block {
        padding: 4% 5%;
        font-size: 0.8rem;
    }

    .hero-name {
        font-size: 1.5rem;
    }

    .portfolio-resume-header {
        font-size: 0.9rem;
    }

    .block p,
    .block ul li {
        font-size: 0.8rem;
    }

    #pp {
        width: 100px;
        height: 100px;
    }
}

/* Landscape orientation adjustments */
@media screen and (max-height: 600px) and (orientation: landscape) {
    .header-grid {
        height: auto;
        min-height: 100vh;
        padding-top: 1rem;
        padding-bottom: 2rem;
    }

    .hero-section {
        min-height: 80vh;
    }

    .block {
        margin-bottom: 1rem;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {

    /* Larger touch targets */
    .nav-button,
    .button,
    a {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .block:hover,
    .nav-button:hover,
    .button:hover {
        transform: none;
    }

    /* Keep tap highlights */
    * {
        -webkit-tap-highlight-color: rgba(204, 122, 81, 0.2);
    }
}