/* ==========================================================================
   Responsive Stylesheet - 반응형 디자인
   Mobile-First Industrial Design
   ========================================================================== */

/* ==========================================================================
   Breakpoints
   Mobile: 375px ~ 768px    (현장 확인용)
   Tablet: 768px ~ 1024px   (사무실 검토용)
   Desktop: 1024px+         (상세 분석용)
   ========================================================================== */

/* ==========================================================================
   Mobile Styles (기본 - Mobile First)
   ========================================================================== */

/* Mobile Navigation */
@media (max-width: 1023px) {
  .mobile-menu-toggle {
    display: flex;
  }
  
  .nav-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--color-white);
    border-top: 1px solid var(--color-gray-200);
    box-shadow: var(--shadow-lg);
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    z-index: 999;
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
  }
  
  .nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
  }
  
  .nav-list {
    flex-direction: column;
    gap: 0;
    padding: var(--space-4) 0;
  }
  
  .nav-item {
    width: 100%;
  }
  
  .nav-link {
    display: block;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--color-gray-100);
    font-size: var(--font-size-lg);
  }
  
  .dropdown-menu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-radius: 0;
    background: var(--color-gray-50);
    margin-left: var(--space-6);
  }
  
  .dropdown-link {
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-base);
  }
}

/* Mobile Hero Section */
@media (max-width: 767px) {
  .hero {
    padding: calc(var(--header-height) + var(--space-1)) 0 var(--space-1);
    min-height: auto;
  }
  
  .hero-content {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    text-align: center;
    margin-bottom: var(--space-4);
  }
  
  .hero-left {
    padding-right: 0;
    order: 2;
  }
  
  .hero-right {
    order: 1;
  }
  
  .hero-title {
    font-size: clamp(1.6rem, 5vw, 2rem);
    text-align: center;
  }
  
  .hero-image-container {
    max-width: 300px;
  }
  
  .hero-description {
    text-align: center;
    font-size: var(--font-size-sm);
  }
  
  .hero-cta {
    text-align: center;
  }
  
  .product-item {
    width: 160px;
    height: 180px;
  }
  
  .product-track {
    gap: var(--space-2);
    width: calc(10 * (160px + var(--space-2)));
  }
  
  @keyframes autoSlide {
    0% {
      transform: translateX(0);
    }
    100% {
      transform: translateX(calc(-7 * (160px + var(--space-2))));
    }
  }
  
  .product-number {
    font-size: var(--font-size-4xl);
  }
  
  .product-info h3 {
    font-size: var(--font-size-xs);
  }
}

/* Mobile Typography */
@media (max-width: 767px) {
  h1 { font-size: var(--font-size-4xl); }
  h2 { font-size: var(--font-size-3xl); }
  h3 { font-size: var(--font-size-2xl); }
  
  .section-title {
    font-size: var(--font-size-3xl);
  }
  
  .section-subtitle {
    font-size: var(--font-size-base);
  }
}

/* Mobile Container */
@media (max-width: 767px) {
  .container {
    padding: 0 var(--space-4);
  }
  
  .section {
    padding: var(--space-16) 0;
  }
}

/* Mobile Cards & Grid */
@media (max-width: 767px) {
  .overview-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  
  .products-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }
  
  .product-card {
    max-width: 100%;
  }
  
  .card-content {
    padding: var(--space-5);
  }
  
  .overview-card {
    padding: var(--space-6);
    text-align: center;
  }
  
  .card-number {
    font-size: var(--font-size-5xl);
    margin-bottom: var(--space-4);
  }
}

/* Mobile CTA */
@media (max-width: 767px) {
  .cta-title {
    font-size: var(--font-size-3xl);
  }
  
  .cta-description {
    font-size: var(--font-size-base);
  }
  
  .cta-actions {
    flex-direction: column;
    align-items: center;
  }
  
  .cta-actions .btn {
    width: 100%;
    max-width: 280px;
  }
}

/* Mobile Footer */
@media (max-width: 767px) {
  .footer-content {
    flex-direction: column;
    gap: var(--space-6);
    text-align: center;
    align-items: center;
  }
  
  .footer-brand {
    flex-direction: column;
    gap: var(--space-3);
    text-align: center;
  }
  
  .footer-info {
    margin-left: 0;
    margin-top: var(--space-6);
  }
  
  .info-row {
    flex-direction: column;
    gap: var(--space-2);
    align-items: center;
    text-align: center;
  }
  
  .info-item {
    white-space: normal;
  }
}

/* Mobile Forms */
@media (max-width: 767px) {
  .form-control {
    font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .btn {
    min-height: 48px; /* Better touch target */
    font-size: var(--font-size-base);
  }
  
  .btn-lg {
    min-height: 56px;
  }
}

/* ==========================================================================
   Tablet Styles (768px ~ 1023px)
   ========================================================================== */

@media (min-width: 768px) and (max-width: 1023px) {
  /* Tablet Hero */
  .hero-content {
    grid-template-columns: 1fr;
    gap: var(--space-12);
    text-align: center;
  }
  
  .hero-left {
    padding-right: 0;
    order: 2;
  }
  
  .hero-right {
    order: 1;
  }
  
  .hero-title {
    font-size: clamp(2rem, 4vw, 2.6rem);
  }
  
  .hero-image-container {
    max-width: 350px;
  }
  
  .product-item {
    width: 180px;
    height: 200px;
  }
  
  .product-track {
    gap: var(--space-2);
    width: calc(10 * (180px + var(--space-2)));
  }
  
  @keyframes autoSlide {
    0% {
      transform: translateX(0);
    }
    100% {
      transform: translateX(calc(-7 * (180px + var(--space-2))));
    }
  }
  
  /* Tablet Grid */
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }
  
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-8);
  }
  
  /* Tablet Footer */
  .footer-content {
    flex-direction: row;
    gap: var(--space-8);
  }
  
  .footer-brand {
    flex-direction: row;
  }
  
  .footer-info {
    margin-left: var(--space-6);
  }
  
  .info-row {
    flex-direction: row;
    gap: var(--space-4);
    flex-wrap: wrap;
  }
}

/* ==========================================================================
   Desktop Styles (1024px+)
   ========================================================================== */

@media (min-width: 1024px) {
  /* Desktop Navigation */
  .nav-menu {
    display: flex;
  }
  
  .mobile-menu-toggle {
    display: none;
  }
  
  /* Desktop Hero */
  .hero-title {
    font-size: var(--font-size-6xl);
  }
  
  .hero-stats {
    justify-content: flex-start;
  }
  
  .gallery-main {
    height: 500px;
  }
  
  /* Desktop Hover Effects */
  .nav-item:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }
  
  .product-card:hover {
    transform: translateY(-8px);
  }
  
  .overview-card:hover {
    transform: translateY(-4px);
  }
  
  /* Desktop Grid */
  .overview-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* Desktop Footer */
  .footer-content {
    justify-content: space-between;
    gap: var(--space-12);
  }
  
  .footer-brand {
    flex-direction: row;
  }
  
  .footer-info {
    margin-left: var(--space-8);
  }
  
  .info-row {
    gap: var(--space-6);
  }
}

/* ==========================================================================
   About Page Responsive Styles
   ========================================================================== */

/* Mobile About Styles */
@media (max-width: 767px) {
  .ceo-content,
  .history-content,
  .values-content,
  .certifications-content,
  .location-content {
    grid-template-columns: 1fr;
    gap: var(--space-12);
  }
  
  .ceo-text,
  .history-text,
  .values-text,
  .certifications-text,
  .location-text {
    padding-right: 0;
    margin-bottom: var(--space-6);
  }
  
  .ceo-visual,
  .history-timeline,
  .values-grid-container,
  .certifications-grid-container,
  .location-map {
    padding-left: 0;
  }
  
  .values-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
  }
  
  .history-text {
    position: static;
  }
  
  .location-info {
    margin-top: var(--space-6);
  }
  
  .map-container {
    height: 300px;
  }
  
  .map-container iframe {
    height: 300px !important;
  }
}

/* Tablet About Styles */
@media (min-width: 768px) and (max-width: 1023px) {
  .ceo-content,
  .history-content,
  .values-content,
  .certifications-content,
  .location-content {
    gap: var(--space-16);
  }
  
  .ceo-text,
  .history-text,
  .values-text,
  .certifications-text,
  .location-text {
    padding-right: var(--space-4);
  }
  
  .ceo-visual,
  .history-timeline,
  .values-grid-container,
  .certifications-grid-container,
  .location-map {
    padding-left: var(--space-4);
  }
  
  .values-grid {
    grid-template-columns: 1fr;
    gap: var(--space-5);
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-6);
  }
}

/* ==========================================================================
   Large Desktop (1200px+)
   ========================================================================== */

@media (min-width: 1200px) {
  .container {
    padding: 0 var(--space-8);
  }
  
  .section {
    padding: var(--space-32) 0;
  }
  
  .hero {
    padding: calc(var(--header-height) + var(--space-1)) 0 var(--space-1);
  }
  
  .gallery-main {
    height: 600px;
  }
  
  .hero-title {
    font-size: 3.1rem; /* 49.6px */
  }
}

/* ==========================================================================
   High DPI / Retina Displays
   ========================================================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* High DPI specific styles */
  .logo-img,
  .card-image img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
  }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
  * {
    background: transparent !important;
    color: black !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }
  
  .header,
  .footer,
  .btn,
  .nav-menu,
  .scroll-indicator {
    display: none !important;
  }
  
  .hero {
    padding: var(--space-4) 0;
    min-height: auto;
  }
  
  .section {
    padding: var(--space-8) 0;
    page-break-inside: avoid;
  }
  
  h1, h2, h3 {
    page-break-after: avoid;
  }
  
  .product-card,
  .overview-card {
    page-break-inside: avoid;
    margin-bottom: var(--space-4);
  }
  
  a::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }
  
  a[href^="#"]::after {
    content: "";
  }
}

/* ==========================================================================
   Accessibility & Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  
  .scroll-indicator {
    animation: none;
  }
  
  .scroll-wheel {
    animation: none;
  }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
  .btn-outline {
    border-width: 2px;
  }
  
  .card,
  .overview-card,
  .product-card {
    border-width: 2px;
  }
  
  .nav-link:focus,
  .btn:focus,
  .form-control:focus {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
  }
}

/* ==========================================================================
   Dark Mode (Optional)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
  /* 미래에 다크모드 지원 시 활용 */
  /* 현재는 기본적으로 라이트 모드만 지원 */
}

/* ==========================================================================
   Touch Device Optimizations
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
  /* Touch device specific styles */
  .btn {
    min-height: 48px;
    padding: var(--space-4) var(--space-6);
  }
  
  .nav-link {
    padding: var(--space-4) var(--space-3);
  }
  
  .form-control {
    min-height: 48px;
    font-size: 16px; /* Prevents zoom on mobile */
  }
  
  /* Remove hover effects on touch devices */
  .product-card:hover,
  .overview-card:hover,
  .btn:hover {
    transform: none;
  }
  
  /* Add touch-friendly active states */
  .btn:active {
    transform: scale(0.98);
  }
  
  .product-card:active,
  .overview-card:active {
    transform: scale(0.98);
  }
}

/* ==========================================================================
   Landscape Mobile Optimization
   ========================================================================== */

@media (max-width: 767px) and (orientation: landscape) {
  .hero {
    padding: calc(var(--header-height) + var(--space-1)) 0 var(--space-1);
    min-height: auto;
  }
  
  .gallery-main {
    height: 300px;
  }
  
  .hero-stats {
    flex-direction: row;
    gap: var(--space-4);
  }
  
  .section {
    padding: var(--space-12) 0;
  }
}

/* ==========================================================================
   Loading & Performance Optimizations
   ========================================================================== */

/* Smooth scrolling on supported devices */
@media (hover: hover) and (pointer: fine) {
  html {
    scroll-behavior: smooth;
  }
}

/* Image loading optimization */
img {
  loading: lazy;
}

/* Critical above-the-fold images */
.hero img,
.logo-img {
  loading: eager;
}

/* ==========================================================================
   Products Page Responsive - Sidebar Layout
   ========================================================================== */

@media (max-width: 768px) {
  .products-layout {
    flex-direction: column;
    min-height: auto;
  }

  .products-sidebar {
    width: 100%;
    min-width: auto;
    position: relative;
    top: auto;
    height: auto;
    padding: var(--space-4);
    border-right: none;
    border-bottom: 1px solid var(--color-gray-200);
  }

  .sidebar-header {
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    text-align: center;
  }

  .sidebar-title {
    font-size: var(--font-size-xl);
  }

  .category-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-2);
  }

  .category-button {
    padding: var(--space-2) var(--space-3);
    font-size: var(--font-size-sm);
  }

  .category-name {
    font-size: var(--font-size-xs);
  }

  .subcategory-list {
    display: none; /* 모바일에서는 서브카테고리 숨김 */
  }

  .products-content {
    padding: var(--space-4);
  }

  .content-title {
    font-size: var(--font-size-2xl);
  }

  .content-description {
    font-size: var(--font-size-base);
  }

  .products-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }

  .product-card {
    margin-bottom: var(--space-4);
  }

  .product-image {
    height: 40%;
  }

  .product-info {
    padding: var(--space-4);
  }

  .product-name {
    font-size: var(--font-size-base);
  }

  .product-desc {
    font-size: var(--font-size-sm);
  }

  .feature-tag {
    font-size: var(--font-size-xs);
    padding: var(--space-1) var(--space-2);
  }

  /* Contact CTA 모바일 조정 */
  .products-cta {
    position: relative;
    bottom: auto;
    right: auto;
    margin: var(--space-6) var(--space-4) 0;
    max-width: none;
  }

  .products-cta.minimized {
    max-width: none;
    width: 60px;
    margin-left: auto;
    margin-right: var(--space-4);
  }

  /* Product Modal Mobile */
  .product-modal-content {
    width: 95%;
    max-height: 90%;
    margin: var(--space-4);
  }

  .product-detail {
    grid-template-columns: 1fr;
    gap: var(--space-4);
    padding: var(--space-4);
  }

  .main-image {
    height: 250px;
  }

  .thumbnail {
    width: 60px;
    height: 60px;
  }

  .product-actions {
    flex-direction: column;
    gap: var(--space-2);
  }

  .product-modal-close {
    top: var(--space-2);
    right: var(--space-2);
    font-size: 1.5rem;
  }
}

@media (max-width: 480px) {
  .products-sidebar {
    padding: var(--space-3);
  }

  .sidebar-header {
    margin-bottom: var(--space-3);
    padding-bottom: var(--space-3);
  }

  .sidebar-title {
    font-size: var(--font-size-lg);
  }

  .category-list {
    grid-template-columns: 1fr;
  }

  .category-button {
    padding: var(--space-3);
  }

  .category-name {
    font-size: var(--font-size-sm);
  }

  .products-content {
    padding: var(--space-3);
  }

  .content-title {
    font-size: var(--font-size-xl);
  }

  .product-image {
    height: 40%;
  }

  .product-info {
    padding: var(--space-3);
  }

  .main-image {
    height: 200px;
  }

  .product-specifications li {
    font-size: var(--font-size-sm);
    padding: var(--space-1) 0;
  }

  .products-cta {
    margin: var(--space-4) var(--space-3) 0;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .products-sidebar {
    width: 280px;
    min-width: 280px;
  }

  .products-content {
    padding: var(--space-6);
  }

  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-5);
  }

  .product-detail {
    gap: var(--space-6);
    padding: var(--space-6);
  }

  .main-image {
    height: 280px;
  }
}

@media (min-width: 1025px) {
  .products-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

/* 대형 화면에서 사이드바 너비 조정 */
@media (min-width: 1400px) {
  .products-layout {
    max-width: 1600px;
  }

  .products-sidebar {
    width: 360px;
    min-width: 360px;
  }
}

/* ==========================================================================
   Browser-specific Fixes
   ========================================================================== */

/* Safari iOS fixes */
@supports (-webkit-touch-callout: none) {
  .form-control {
    font-size: 16px; /* Prevents zoom */
  }
  
  .btn {
    -webkit-appearance: none;
  }
}

/* Firefox fixes */
@-moz-document url-prefix() {
  .form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
  }
}

/* Edge fixes */
@supports (-ms-ime-align:auto) {
  .form-control::-ms-clear {
    display: none;
  }
}