/* =================================================================
   MOBILE-FIRST RESPONSIVE DESIGN FOUNDATION
   ================================================================= */

/* Reset and Base Font Size (Mobile First) */
:root {
    /* Font size variables - all minimum 16px for mobile accessibility */
    --font-base: 16px;
    --font-small: 16px;     /* Changed from 14px */
    --font-medium: 18px;
    --font-large: 20px;
    --font-xl: 24px;
    --font-xxl: 28px;
    
    /* Touch target minimum sizes */
    --touch-target-min: 44px;
    --touch-spacing: 8px;
    
    /* Line heights for readability */
    --line-height-compact: 1.4;
    --line-height-base: 1.5;
    --line-height-relaxed: 1.6;
}

/* Base mobile-first typography */
html {
    font-size: 16px; /* Base 16px for accessibility */
}

body {
    font-size: var(--font-base);
    line-height: var(--line-height-base);
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* =================================================================
   FONT SIZE FIXES - ALL ELEMENTS MINIMUM 16PX
   ================================================================= */

/* Force minimum font sizes */
* {
    font-size: inherit; /* Inherit from parent, preventing smaller sizes */
}

/* Global font size overrides - Mobile First */
p, span, div, a, button, input, select, textarea,
.small, .text-small, .caption, .meta, .note {
    font-size: var(--font-base) !important; /* Force 16px minimum */
    line-height: var(--line-height-base);
}

/* Navigation Elements */
.nav-link, .navbar-nav .nav-link, .nav-text, .nav-text-en {
    font-size: var(--font-base) !important;
    line-height: var(--line-height-compact);
}

/* Footer Elements */
.footer-description, .footer-contact p, .social-label,
.footer-bottom, .footer-bottom p, .footer-bottom span {
    font-size: var(--font-base) !important;
}

.footer-accordion .btn {
    font-size: var(--font-base) !important;
}

.footer-accordion .fa {
    font-size: var(--font-base) !important;
}

/* Card and Content Elements */
.card-text, .card-title, .news-date, .generation-year,
.back-link, .reel-caption p, .quote-text {
    font-size: var(--font-base) !important;
}

/* Form Elements */
.form-label, .form-control, .btn, input, select, textarea {
    font-size: var(--font-base) !important;
}

/* Override all small font classes */
.text-muted, .text-secondary, .small-text,
.caption, .note, .meta, .subtitle {
    font-size: var(--font-base) !important;
}

/* =================================================================
   TOUCH TARGET OPTIMIZATION - MINIMUM 44PX
   ================================================================= */

/* All interactive elements minimum touch target */
button, .btn, a, input, select, textarea,
.nav-link, .social-link, .card, .hamburger-menu {
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    padding: 12px 16px;
    margin: var(--touch-spacing) 0;
    
    /* Ensure clickable area */
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    
    /* Touch-friendly spacing */
    line-height: 1.2;
}

/* Navigation links mobile optimization */
.navbar-nav .nav-link {
    padding: 16px 20px !important;
    margin: 4px 0;
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
}

/* Mobile menu button */
.hamburger-menu, .navbar-toggle, .mobile-menu-toggle {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    padding: 12px;
    margin: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
}

/* Social media buttons */
.social-link {
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    padding: 10px;
    margin: 8px 4px;
    border-radius: 50%;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Form inputs touch-friendly */
.form-control, input, select, textarea {
    min-height: var(--touch-target-min);
    padding: 12px 16px;
    font-size: var(--font-base) !important;
    border-radius: 8px;
    border: 2px solid #ddd;
}

/* Buttons enhanced for touch */
.btn {
    min-height: var(--touch-target-min);
    padding: 12px 24px;
    font-size: var(--font-base) !important;
    font-weight: 500;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn:hover, .btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Card elements touch-friendly */
.card, .product-card, .news-card {
    margin: 16px 0;
    padding: 20px;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

/* =================================================================
   MOBILE-FIRST RESPONSIVE LAYOUT
   ================================================================= */

/* Mobile First - Base styles for smallest screens */
.container, .container-fluid {
    padding-left: 16px;
    padding-right: 16px;
    max-width: 100%;
    margin: 0 auto;
}

/* Navigation mobile-first */
.navbar {
    padding: 12px 16px;
    min-height: 60px;
}

.navbar-brand {
    font-size: var(--font-large) !important;
    font-weight: 600;
}

/* Footer mobile-first */
.site-footer {
    padding: 32px 16px 24px;
}

.footer-section {
    margin-bottom: 32px;
}

/* Content spacing mobile-first */
.section {
    padding: 32px 16px;
}

.hero-section {
    padding: 48px 16px;
    text-align: center;
}

/* =================================================================
   PROGRESSIVE ENHANCEMENT - TABLET AND DESKTOP
   ================================================================= */

/* Tablet styles (768px and up) */
@media (min-width: 768px) {
    .container {
        padding-left: 24px;
        padding-right: 24px;
        max-width: 750px;
    }
    
    .navbar {
        padding: 16px 24px;
    }
    
    .section {
        padding: 48px 24px;
    }
    
    .hero-section {
        padding: 64px 24px;
    }
    
    /* Font sizes can be slightly larger on tablet */
    h1 { font-size: var(--font-xxl); }
    h2 { font-size: var(--font-xl); }
    h3 { font-size: var(--font-large); }
    
    /* Touch targets can be slightly smaller on tablet */
    .nav-link {
        padding: 12px 16px !important;
    }
}

/* Desktop styles (1024px and up) */
@media (min-width: 1024px) {
    .container {
        padding-left: 32px;
        padding-right: 32px;
        max-width: 1000px;
    }
    
    .navbar {
        padding: 20px 32px;
    }
    
    .section {
        padding: 64px 32px;
    }
    
    .hero-section {
        padding: 80px 32px;
        text-align: left;
    }
    
    /* Desktop can use mouse interactions */
    .btn:hover {
        transform: translateY(-1px);
    }
    
    /* Desktop navigation can be more compact */
    .navbar-nav .nav-link {
        padding: 10px 16px !important;
        margin: 0 4px;
    }
}

/* Large desktop styles (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
        padding-left: 40px;
        padding-right: 40px;
    }
    
    .section {
        padding: 80px 40px;
    }
    
    .hero-section {
        padding: 100px 40px;
    }
}

/* =================================================================
   ACCESSIBILITY ENHANCEMENTS
   ================================================================= */

/* Focus states for keyboard navigation */
button:focus, .btn:focus, a:focus, input:focus, select:focus, textarea:focus {
    outline: 3px solid #007bff;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    button, .btn, a, input, select, textarea {
        border: 2px solid currentColor;
    }
}

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

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

@media print {
    * {
        font-size: 12pt !important;
        line-height: 1.4 !important;
    }
    
    .navbar, .footer, .btn {
        display: none !important;
    }
}

/* =================================================================
   PERFORMANCE OPTIMIZATIONS
   ================================================================= */

/* GPU acceleration for smooth animations */
.hamburger-menu, .btn, .card, .social-link {
    will-change: transform;
    transform: translateZ(0);
}

/* Optimize font rendering */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-display: swap;
}

/* Optimize images for performance */
img {
    contain-intrinsic-size: 300px 200px;
}

/* =================================================================
   UTILITY CLASSES
   ================================================================= */

/* Spacing utilities */
.mt-mobile { margin-top: 16px; }
.mb-mobile { margin-bottom: 16px; }
.py-mobile { padding-top: 16px; padding-bottom: 16px; }
.px-mobile { padding-left: 16px; padding-right: 16px; }

/* Typography utilities */
.text-mobile-center { text-align: center; }
.text-mobile-left { text-align: left; }

/* Visibility utilities */
.mobile-only { display: block; }
.desktop-only { display: none; }

@media (min-width: 768px) {
    .mobile-only { display: none; }
    .desktop-only { display: block; }
}

/* =================================================================
   HAMBURGER MENU ENHANCEMENTS
   ================================================================= */

/* Ensure hamburger menu is properly sized and accessible */
.hamburger-menu {
    position: relative;
    width: var(--touch-target-min);
    height: var(--touch-target-min);
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 8px;
}

.hamburger-menu span {
    display: block;
    width: 24px;
    height: 3px;
    background: currentColor;
    margin: 3px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger-menu.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile navigation menu */
.mobile-nav {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
}

.mobile-nav.active {
    display: block;
}

.mobile-nav .nav-link {
    display: block;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
    font-size: var(--font-base) !important;
    color: #333;
    text-decoration: none;
}

.mobile-nav .nav-link:hover {
    background: #f8f9fa;
}

/* =================================================================
   RESPONSIVE IMAGES OPTIMIZATION
   ================================================================= */

/* Logo responsive sizing */
.brand-logo-img, .mobile-logo, .footer-logo-img {
    width: auto;
    height: auto;
    max-width: 100%;
    object-fit: contain;
    transition: transform 0.3s ease;
}

/* Product images responsive */
.product-img, .card-img-top, .gallery-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.product-img:hover, .card-img-top:hover, .gallery-img:hover {
    transform: scale(1.05);
}

/* Hero images optimization */
.hero-image, .banner-image {
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: center;
}

/* Lazy loading support - fade in on load */
img[loading="lazy"] {
    transition: opacity 0.3s ease;
}

/* WebP support fallback */
.webp-support img {
    /* Modern browsers with WebP support will use optimized formats */
}

/* Mobile-first image sizing */
@media (max-width: 768px) {
    .brand-logo-img {
        max-height: 40px;
    }
    
    .mobile-logo {
        max-height: 32px;
    }
    
    .footer-logo-img {
        max-height: 48px;
    }
    
    .product-img, .card-img-top {
        aspect-ratio: 16/9;
        object-fit: cover;
    }
}

/* Tablet optimization */
@media (min-width: 768px) and (max-width: 1024px) {
    .brand-logo-img {
        max-height: 50px;
    }
    
    .footer-logo-img {
        max-height: 56px;
    }
}

/* Desktop optimization */
@media (min-width: 1024px) {
    .brand-logo-img {
        max-height: 60px;
    }
    
    .footer-logo-img {
        max-height: 64px;
    }
}

/* =================================================================
   SPECIFIC OVERRIDES FOR EXISTING CLASSES
   ================================================================= */

/* Override any existing small font declarations */
.footer-description,
.footer-contact p,
.social-label,
.nav-text-en,
.generation-year,
.news-date,
.card-text,
.reel-caption p,
.back-link i,
.footer-bottom {
    font-size: var(--font-base) !important;
}

/* Ensure all Bootstrap small text classes are overridden */
.text-sm, .small, .text-muted, .text-secondary {
    font-size: var(--font-base) !important;
}

/* Override any rem-based small fonts */
.font-sm, [class*="text-0"], [class*="font-0"] {
    font-size: var(--font-base) !important;
}