/**
 * Mobile Responsive Fixes and Enhancements
 * Comprehensive mobile responsiveness improvements for thehonestape.github.io
 * Uses variables from core/variables.css for consistency
 */

/* ===== CONTAINER AND SPACING FIXES ===== */

/* Ensure consistent container padding across all screen sizes */
.container {
    padding-left: var(--mobile-padding-sm);
    padding-right: var(--mobile-padding-sm);
}

@media screen and (max-width: 480px) {
    .container {
        padding-left: var(--mobile-padding-xs);
        padding-right: var(--mobile-padding-xs);
    }
    
    /* Reduce section padding on very small screens */
    .section {
        padding: var(--mobile-padding-md) 0;
    }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
    .container {
        padding-left: var(--mobile-padding-md);
        padding-right: var(--mobile-padding-md);
    }
}

@media screen and (min-width: 769px) {
    .container {
        padding-left: var(--mobile-padding-lg);
        padding-right: var(--mobile-padding-lg);
    }
}

/* ===== TOUCH TARGET OPTIMIZATION ===== */

/* Ensure all interactive elements meet minimum touch target size */
.button,
.navbar-item,
.navbar-burger,
a.tag,
.card a,
input[type="submit"],
input[type="button"] {
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
}

/* Comfortable touch targets for primary actions */
.button.is-primary,
.button.is-large,
.navbar-burger {
    min-height: var(--touch-target-comfortable);
    min-width: var(--touch-target-comfortable);
}

/* Mobile-specific button improvements */
@media screen and (max-width: 768px) {
    .button {
        font-size: 1rem;
        padding: 0.75rem 1.25rem;
        border-radius: 8px;
    }
    
    .button.is-small {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    /* Increase spacing between buttons */
    .button + .button {
        margin-left: 0.75rem;
    }
    
    /* Stack buttons vertically on very small screens */
    @media screen and (max-width: 480px) {
        .buttons {
            flex-direction: column;
            align-items: stretch;
        }
        
        .button + .button {
            margin-left: 0;
            margin-top: 0.75rem;
        }
    }
}

/* ===== ENHANCED MOBILE TYPOGRAPHY ===== */

/* More aggressive mobile typography scaling */
@media screen and (max-width: 768px) {
    .title.is-1,
    .is-size-1 {
        font-size: clamp(1.75rem, 8vw, 2.5rem) !important;
        line-height: 1.1;
    }
    
    .title.is-2,
    .is-size-2 {
        font-size: clamp(1.5rem, 6vw, 2rem) !important;
        line-height: 1.2;
    }
    
    .title.is-3,
    .is-size-3 {
        font-size: clamp(1.25rem, 5vw, 1.75rem) !important;
        line-height: 1.25;
    }
    
    .title.is-4,
    .is-size-4 {
        font-size: clamp(1.1rem, 4vw, 1.5rem) !important;
        line-height: 1.3;
    }
    
    /* Improve readability */
    p,
    .content p {
        line-height: 1.6;
        margin-bottom: 1.25rem;
    }
    
    /* Reduce letter spacing on small screens */
    .title,
    .heading {
        letter-spacing: -0.025em;
    }
}

@media screen and (max-width: 480px) {
    /* Even more aggressive scaling for very small screens */
    .title.is-1,
    .is-size-1 {
        font-size: clamp(1.5rem, 10vw, 2.25rem) !important;
    }
    
    .title.is-2,
    .is-size-2 {
        font-size: clamp(1.3rem, 8vw, 1.875rem) !important;
    }
    
    /* Increase base font size slightly for better readability */
    body {
        font-size: 1.05rem;
    }
}

/* ===== NAVIGATION MOBILE ENHANCEMENTS ===== */

@media screen and (max-width: 1023px) {
    /* Improve mobile menu positioning and appearance */
    .navbar-menu {
        position: fixed !important;
        top: 80px !important;
        left: 0 !important;
        right: 0 !important;
        background-color: rgba(1, 0, 1, 0.98) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border-top: 1px solid rgba(255, 255, 255, 0.1);
        z-index: 50;
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        padding: 1.5rem 0 !important;
    }
    
    /* Improve menu item spacing and touch targets */
    .navbar-item {
        padding: 1rem 1.5rem !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        transition: background-color 0.2s ease;
    }
    
    .navbar-item:hover,
    .navbar-item:focus {
        background-color: rgba(255, 255, 255, 0.08) !important;
    }
    
    /* Better hamburger positioning */
    .navbar-burger {
        position: relative;
        z-index: 51;
    }
}

/* ===== CARD AND CONTENT MOBILE IMPROVEMENTS ===== */

@media screen and (max-width: 768px) {
    /* Improve card layouts */
    .card {
        margin-bottom: 1.5rem;
        border-radius: 12px;
    }
    
    /* Remove custom padding - use utility classes instead */
    .card-header {
        padding: 1rem 1.25rem;
    }
    
    /* Better image handling */
    .card-image figure,
    .image {
        border-radius: 8px;
        overflow: hidden;
    }
    
    /* Improve text in cards */
    .card-content .title {
        margin-bottom: 0.75rem;
    }
    
    .card-content .subtitle {
        margin-bottom: 0.5rem;
    }
}

/* ===== HERO SECTION MOBILE FIXES ===== */

@media screen and (max-width: 1023px) {
    .hero {
        padding: var(--mobile-padding-md) 0;
    }
    
    .hero .container {
        padding: 0 var(--mobile-padding-sm);
    }
    
    /* Ensure hero content is properly spaced */
    .hero .columns {
        gap: 2rem;
    }
    
    .hero .column {
        padding: 0;
    }
}

@media screen and (max-width: 480px) {
    .hero {
        padding: var(--mobile-padding-sm) 0;
    }
    
    .hero .columns {
        gap: 1.5rem;
    }
}

/* ===== MASONRY GRID MOBILE ENHANCEMENTS ===== */

@media screen and (max-width: 768px) {
    .masonry-grid {
        margin: 1rem 0;
    }
    
    /* Improve grid item spacing */
    .masonry-grid .columns {
        margin: 0;
        gap: 1rem;
    }
    
    .masonry-grid .column {
        padding: 0;
        margin-bottom: 1rem;
    }
    
    /* Better post card appearance */
    .masonry-card .card {
        border-radius: 10px;
        overflow: hidden;
    }
    
    /* Cards will use utility classes or Bulma defaults */
}

/* ===== TERMINAL/NAVIGATION CARD MOBILE FIXES ===== */

@media screen and (max-width: 1023px) {
    .navigation-card {
        margin: 0 auto;
        max-width: none;
        border-radius: 12px;
    }
    
    /* Use Bulma helper classes for consistent spacing */
    .navigation-card .card-content {
        padding: 1.25rem !important; /* Keep important for override specificity */
    }
    
    .navigation-card .card-header {
        padding: 0.75rem 1rem !important;
    }
    
    /* Improve terminal content readability */
    .terminal-content {
        font-size: 0.9rem;
        line-height: 1.4;
    }
}

/* ===== GALLERY MOBILE IMPROVEMENTS ===== */

@media screen and (max-width: 768px) {
    .gallery-masonry {
        column-gap: 0.75rem;
        margin: 1rem 0;
    }
    
    .gallery-item {
        margin-bottom: 0.75rem;
        border-radius: 8px;
        overflow: hidden;
    }
}

@media screen and (max-width: 480px) {
    .gallery-masonry {
        column-count: 1;
        column-gap: 0;
    }
}

/* ===== UTILITY CLASSES FOR MOBILE ===== */

/* Hide elements on mobile */
.is-hidden-mobile {
    display: none !important;
}

@media screen and (min-width: 769px) {
    .is-hidden-mobile {
        display: block !important;
    }
}

/* Show only on mobile */
.is-mobile-only {
    display: block !important;
}

@media screen and (min-width: 769px) {
    .is-mobile-only {
        display: none !important;
    }
}

/* Mobile-specific spacing utilities */
.mobile-spacing-sm {
    padding: var(--mobile-padding-sm);
}

.mobile-spacing-md {
    padding: var(--mobile-padding-md);
}

.mobile-margin-bottom {
    margin-bottom: var(--mobile-padding-md);
}

@media screen and (min-width: 769px) {
    .mobile-spacing-sm,
    .mobile-spacing-md {
        padding: 0;
    }
    
    .mobile-margin-bottom {
        margin-bottom: 0;
    }
}

/* ===== FORM IMPROVEMENTS ===== */

@media screen and (max-width: 768px) {
    .field {
        margin-bottom: 1.5rem;
    }
    
    .input,
    .textarea {
        font-size: 1rem; /* Prevent zoom on iOS */
        padding: 0.75rem;
        border-radius: 8px;
    }
    
    .select select {
        font-size: 1rem;
        padding: 0.75rem;
    }
    
    /* Stack form elements */
    .field.is-grouped {
        flex-direction: column;
    }
    
    .field.is-grouped .control {
        margin-bottom: 1rem;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* Improve focus indicators for mobile/touch */
@media screen and (max-width: 768px) {
    .button:focus,
    .navbar-item:focus,
    .card:focus-within {
        outline: 3px solid rgba(66, 153, 225, 0.5);
        outline-offset: 2px;
    }
    
    /* Remove outline for mouse users, keep for keyboard/touch */
    .button:focus:not(:focus-visible),
    .navbar-item:focus:not(:focus-visible) {
        outline: none;
    }
}

/* ===== REDUCED MOTION RESPECT ===== */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== PRINT STYLES ===== */

@media print {
    .navbar,
    .navbar-burger,
    .is-hidden-print {
        display: none !important;
    }
    
    .container {
        max-width: none !important;
        padding: 0 !important;
    }
    
    .hero {
        page-break-inside: avoid;
    }
}

