/* Mobile-First Responsive Enhancements for Muttizettel Hugo Theme */

/* Base mobile styles */
@media (max-width: 480px) {
    /* Typography scaling */
    body {
        font-size: 14px;
        line-height: 1.5;
    }
    
    h1 {
        font-size: 24px;
        margin: 10px 0;
        padding: 10px;
    }
    
    h2 {
        font-size: 20px;
        margin: 8px 0;
    }
    
    h3 {
        font-size: 18px;
        margin: 6px 0;
    }
    
    h4 {
        font-size: 16px;
        margin: 6px 0;
        text-transform: none;
    }
    
    h5, h6 {
        font-size: 14px;
        margin: 4px 0;
    }
    
    p {
        font-size: 14px;
        line-height: 1.6;
        margin-bottom: 12px;
    }
    
    /* Layout adjustments */
    .wrapper {
        padding: 0 5px;
    }
    
    .hugo-content {
        padding: 5px;
    }
    
    .content-section {
        padding: 15px;
        margin-bottom: 15px;
        border-radius: 0;
    }
    
    /* Header mobile optimization */
    header {
        height: auto;
        padding: 10px 0;
    }
    
    header h6 {
        float: none;
        text-align: center;
        font-size: 28px;
        margin-bottom: 10px;
    }
    
    header nav {
        float: none;
        text-align: center;
    }
    
    header nav ul li {
        float: none;
        display: block;
        margin: 5px 0;
    }
    
    header nav ul li a {
        display: block;
        padding: 8px;
        margin: 0;
        background-color: #f8fafa;
        border-radius: 3px;
    }
    
    /* Navigation improvements */
    .hugo-nav {
        margin-bottom: 20px;
    }
    
    .hugo-nav a {
        display: block;
        margin: 5px 0;
        padding: 12px 15px;
        text-align: center;
        font-size: 14px;
    }
    
    /* Button optimizations */
    .button {
        width: 100%;
        margin-bottom: 15px;
        font-size: 16px;
        height: 48px;
        line-height: 44px;
    }
    
    .btn {
        width: 100%;
        padding: 10px;
        margin-bottom: 10px;
        display: block;
        text-align: center;
    }
    
    .more-link {
        display: inline-block;
        width: 100%;
        text-align: center;
        margin: 10px 0;
    }
    
    /* Table responsiveness */
    table {
        width: 100%;
        font-size: 12px;
    }
    
    th, td {
        padding: 8px 4px;
        word-wrap: break-word;
    }
    
    /* Make tables scroll horizontally on very small screens */
    .table-container {
        overflow-x: auto;
        margin: 10px 0;
    }
    
    /* List improvements */
    ul, ol {
        padding-left: 15px;
    }
    
    li {
        margin-bottom: 6px;
    }
    
    /* Footer mobile */
    footer {
        padding: 30px 0;
    }
    
    #footer-info {
        float: none;
        width: 100%;
        text-align: center;
        margin-bottom: 20px;
    }
    
    #footer-links {
        float: none;
        width: 100%;
        text-align: center;
    }
    
    #footer-links ul {
        float: none;
        margin: 0 0 10px 0;
        padding: 0;
        list-style: none;
    }
    
    #footer-links ul li {
        display: inline-block;
        margin: 0 10px;
    }
    
    /* Content sections mobile */
    #primary-content {
        padding: 10px 0;
    }
    
    #secondary-content {
        padding: 20px 0;
    }
    
    #secondary-content article {
        float: none;
        width: 100%;
        margin-bottom: 20px;
        height: auto;
        min-height: 200px;
    }
    
    #secondary-content article .overlay {
        width: auto;
        height: auto;
        padding: 15px;
    }
}

/* Tablet styles */
@media (min-width: 481px) and (max-width: 768px) {
    body {
        font-size: 15px;
    }
    
    h1 {
        font-size: 32px;
    }
    
    h2 {
        font-size: 26px;
    }
    
    h3 {
        font-size: 22px;
    }
    
    .hugo-content {
        padding: 15px;
    }
    
    .content-section {
        padding: 25px;
    }
    
    .button {
        width: 300px;
    }
    
    /* Two-column layout for tablets */
    #secondary-content article {
        width: 48%;
        margin-right: 2%;
    }
    
    #secondary-content article:nth-child(even) {
        margin-right: 0;
    }
}

/* Large mobile / small tablet */
@media (min-width: 769px) and (max-width: 1000px) {
    .wrapper {
        padding: 0 20px;
    }
    
    .hugo-content {
        padding: 20px;
    }
    
    header nav ul li a {
        margin-right: 15px;
    }
}

/* Touch-friendly improvements */
@media (pointer: coarse) {
    /* Increase touch targets */
    a, button, .button, .more-link {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    header nav ul li a {
        min-height: 44px;
        padding: 10px 15px;
    }
}

/* High DPI screens */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Optimize for retina displays */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    /* Reduce header height in landscape */
    header {
        padding: 5px 0;
    }
    
    header h6 {
        font-size: 24px;
        margin-bottom: 5px;
    }
    
    .hugo-content {
        padding: 10px;
    }
}

/* Dark mode explicitly disabled */

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    /* Focus indicators */
    a:focus, button:focus, .button:focus {
        outline: 3px solid #02b8dd;
        outline-offset: 2px;
    }
    
    /* Skip to content link */
    .skip-to-content {
        position: absolute;
        top: -40px;
        left: 6px;
        background: #02b8dd;
        color: white;
        padding: 8px;
        text-decoration: none;
        border-radius: 3px;
        z-index: 1000;
    }
    
    .skip-to-content:focus {
        top: 6px;
    }
    
    /* Better contrast for small text */
    small {
        color: #555;
        font-size: 12px;
    }
}

/* Performance optimizations for mobile */
@media (max-width: 768px) {
    /* Reduce animations on mobile to save battery */
    *, *::before, *::after {
        transition-duration: 0.1s !important;
        animation-duration: 0.1s !important;
    }
    
    /* Optimize images for mobile */
    img {
        max-width: 100%;
        height: auto;
        display: block;
        margin: 10px 0;
    }
    
    /* Lazy loading hint */
    img[loading="lazy"] {
        opacity: 0;
        transition: opacity 0.3s;
    }
    
    img[loading="lazy"].loaded {
        opacity: 1;
    }
}