/**
 * 서가건설 - Responsive Stylesheet
 * 반응형 디자인 규칙
 */

/* ===================================
   Desktop Large (1400px+)
   =================================== */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }

    .hero-title {
        font-size: 4.5rem;
    }

    .services-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .portfolio-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===================================
   Desktop (1200px - 1399px)
   =================================== */
@media (max-width: 1399px) {
    .container {
        max-width: 1140px;
    }
}

/* ===================================
   Laptop (992px - 1199px)
   =================================== */
@media (max-width: 1199px) {
    .container {
        max-width: 960px;
    }

    .header-inner {
        padding: 0 16px;
    }

    .main-nav a {
        padding: 8px 12px;
        font-size: 0.875rem;
    }

    .hero-title {
        font-size: 3rem;
    }

    .hero-stats {
        gap: 32px;
    }

    .services-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
}

/* ===================================
   Tablet (768px - 991px)
   =================================== */
@media (max-width: 991px) {
    :root {
        font-size: 15px;
    }

    .container {
        max-width: 720px;
    }

    /* Header */
    .site-header {
        height: 60px;
    }

    .header-inner {
        height: 60px;
    }

    .main-nav {
        display: none;
    }

    .header-phone {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    /* Hero */
    .hero {
        padding-top: 60px;
    }

    .hero-content {
        text-align: center;
        max-width: 100%;
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .hero-actions {
        justify-content: center;
    }

    .hero-stats {
        justify-content: center;
        gap: 24px;
    }

    .hero-stat-value {
        font-size: 2rem;
    }

    /* Sections */
    .section {
        padding: 60px 0;
    }

    .section-lg {
        padding: 80px 0;
    }

    .section-title {
        font-size: 1.875rem;
    }

    /* Services */
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .service-card {
        padding: 24px 20px;
    }

    .service-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
    }

    .service-title {
        font-size: 1.125rem;
    }

    /* Portfolio */
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    /* Forms */
    .service-selection {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
        text-align: center;
    }

    .footer-brand {
        max-width: 100%;
    }

    .footer-brand .logo {
        justify-content: center;
    }

    .footer-links {
        align-items: center;
    }

    .footer-contact {
        align-items: center;
    }

    .footer-contact-item {
        justify-content: center;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }

    /* Slider */
    .slider-slide img {
        height: 400px;
    }

    .slider-nav {
        width: 40px;
        height: 40px;
    }

    .slider-nav-prev {
        left: 12px;
    }

    .slider-nav-next {
        right: 12px;
    }
}

/* ===================================
   Mobile (576px - 767px)
   =================================== */
@media (max-width: 767px) {
    :root {
        font-size: 14px;
    }

    .container {
        max-width: 540px;
        padding: 0 16px;
    }

    /* Typography */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.375rem; }
    h4 { font-size: 1.125rem; }

    /* Header */
    .logo-text {
        font-size: 1rem;
    }

    .logo-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    /* Hero */
    .hero {
        min-height: auto;
        padding: 100px 0 60px;
    }

    .hero-badge {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
    }

    .hero-stats {
        flex-direction: column;
        gap: 16px;
        padding-top: 32px;
        margin-top: 32px;
    }

    .hero-stat-value {
        font-size: 1.75rem;
    }

    /* Sections */
    .section {
        padding: 48px 0;
    }

    .section-lg {
        padding: 60px 0;
    }

    .section-header {
        margin-bottom: 40px;
    }

    .section-title {
        font-size: 1.625rem;
    }

    .section-subtitle {
        font-size: 1rem;
    }

    /* Services */
    .services-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .service-card {
        display: flex;
        align-items: center;
        text-align: left;
        padding: 20px;
        gap: 16px;
    }

    .service-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
        margin: 0;
        flex-shrink: 0;
    }

    .service-content {
        flex: 1;
    }

    .service-title {
        font-size: 1rem;
        margin-bottom: 4px;
    }

    .service-desc {
        font-size: 0.875rem;
        margin: 0;
    }

    /* Portfolio */
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .portfolio-item {
        aspect-ratio: 16/9;
    }

    /* Reviews */
    .review-card {
        padding: 24px 20px;
    }

    /* FAQ */
    .faq-question {
        padding: 16px 20px;
        font-size: 0.9375rem;
    }

    .faq-answer-inner {
        padding: 0 20px 16px;
        font-size: 0.9375rem;
    }

    /* Forms */
    .form-input,
    .form-textarea,
    .form-select {
        padding: 12px 14px;
    }

    .form-radio-group {
        flex-direction: column;
    }

    .service-selection {
        gap: 12px;
    }

    .service-option {
        padding: 16px;
    }

    .service-option-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    /* Image Upload */
    .upload-area {
        padding: 24px 16px;
    }

    .upload-icon {
        width: 48px;
        height: 48px;
    }

    /* Slider */
    .slider-slide img {
        height: 300px;
    }

    .slider-nav {
        width: 36px;
        height: 36px;
    }

    .slider-nav svg {
        width: 16px;
        height: 16px;
    }

    /* Cards */
    .card-body {
        padding: 20px;
    }

    .card-img {
        height: 180px;
    }

    /* Buttons */
    .btn {
        padding: 12px 20px;
        font-size: 0.875rem;
    }

    .btn-lg {
        padding: 14px 24px;
        font-size: 0.9375rem;
    }

    /* Modal */
    .modal {
        width: 95%;
        max-height: 85vh;
    }

    .modal-header {
        padding: 16px 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .modal-footer {
        padding: 12px 20px;
    }

    /* Toast */
    .toast-container {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }

    .toast {
        min-width: auto;
    }

    /* Footer */
    .footer-legal {
        flex-wrap: wrap;
        justify-content: center;
        gap: 16px;
    }
}

/* ===================================
   Mobile Small (< 576px)
   =================================== */
@media (max-width: 575px) {
    .container {
        padding: 0 12px;
    }

    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }

    /* Header */
    .header-inner {
        padding: 0 12px;
    }

    .logo-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    /* Hero */
    .hero {
        padding: 80px 0 48px;
    }

    .hero-title {
        font-size: 1.625rem;
        line-height: 1.3;
    }

    .hero-subtitle {
        font-size: 0.9375rem;
    }

    /* Sections */
    .section {
        padding: 40px 0;
    }

    .section-title {
        font-size: 1.5rem;
    }

    /* Cards */
    .service-card {
        padding: 16px;
    }

    .service-icon {
        width: 48px;
        height: 48px;
        font-size: 20px;
        border-radius: 8px;
    }

    /* Forms */
    .form-label {
        font-size: 0.875rem;
    }

    .form-input,
    .form-textarea,
    .form-select {
        padding: 10px 12px;
        font-size: 0.9375rem;
    }

    /* Image Upload */
    .upload-area {
        padding: 20px 12px;
    }

    .upload-text {
        font-size: 0.875rem;
    }

    .upload-hint {
        font-size: 0.8125rem;
    }

    .upload-preview {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    /* Slider */
    .slider-slide img {
        height: 220px;
    }

    /* Footer */
    .site-footer {
        padding: 40px 0 0;
    }

    .footer-grid {
        gap: 24px;
    }
}

/* ===================================
   Mobile Navigation Overlay
   =================================== */
.mobile-nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 320px;
    height: 100vh;
    background: white;
    z-index: calc(var(--z-fixed) + 10);
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
}

.mobile-nav.active {
    right: 0;
}

.mobile-nav-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #eee;
}

.mobile-nav-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-secondary);
}

.mobile-nav-links {
    padding: 20px;
}

.mobile-nav-links a {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: all var(--transition-fast);
}

.mobile-nav-links a:hover,
.mobile-nav-links a.active {
    background: rgba(102, 126, 234, 0.1);
    color: var(--primary);
}

.mobile-nav-cta {
    padding: 20px;
    border-top: 1px solid #eee;
}

.mobile-nav-cta .btn {
    width: 100%;
    margin-bottom: 12px;
}

.mobile-nav-phone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    background: var(--bg-gray);
    border-radius: var(--radius-md);
    font-weight: 600;
}

.mobile-nav-phone svg {
    width: 18px;
    height: 18px;
    color: var(--primary);
}

.mobile-nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--z-fixed) + 5);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-nav-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===================================
   Mobile Bottom CTA Bar
   =================================== */
.mobile-cta-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: var(--z-fixed);
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.mobile-cta-inner {
    display: flex;
    gap: 12px;
}

.mobile-cta-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
}

.mobile-cta-call {
    background: white;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.mobile-cta-quote {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.mobile-cta-btn svg {
    width: 20px;
    height: 20px;
}

/* Show mobile bottom CTA on mobile */
@media (max-width: 991px) {
    .mobile-cta-bar {
        display: block;
    }

    /* Add padding to body to prevent content hidden by bottom bar */
    body {
        padding-bottom: 80px;
    }

    /* Adjust footer padding */
    .site-footer {
        margin-bottom: 0;
    }
}

/* ===================================
   Mobile Top Call Bar
   =================================== */
.mobile-call-bar {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    z-index: calc(var(--z-fixed) - 1);
    padding: 10px 16px;
}

.mobile-call-bar a {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: white;
    font-weight: 600;
    font-size: 0.9375rem;
}

.mobile-call-bar svg {
    width: 18px;
    height: 18px;
    animation: phone-ring 1.5s ease infinite;
}

@keyframes phone-ring {
    0%, 100% { transform: rotate(0); }
    10%, 30% { transform: rotate(-10deg); }
    20%, 40% { transform: rotate(10deg); }
    50% { transform: rotate(0); }
}

@media (max-width: 991px) {
    .mobile-call-bar {
        display: block;
    }

    /* Adjust hero padding when call bar is visible */
    .hero {
        padding-top: 110px;
    }
}

/* ===================================
   Touch Optimization
   =================================== */
@media (hover: none) and (pointer: coarse) {
    /* Disable hover effects on touch devices */
    .card:hover,
    .service-card:hover,
    .portfolio-item:hover img,
    .btn:hover {
        transform: none;
    }

    /* Larger touch targets */
    .btn {
        min-height: 48px;
    }

    .main-nav a {
        min-height: 44px;
    }

    .faq-question {
        min-height: 56px;
    }
}

/* ===================================
   Landscape Orientation
   =================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 80px 0 40px;
    }

    .hero-stats {
        flex-direction: row;
        gap: 32px;
    }
}

/* ===================================
   High DPI Screens
   =================================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Use higher resolution images */
}

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

    .hero-bg-gradient {
        animation: none;
    }
}

/* ===================================
   Dark Mode Responsive Adjustments
   =================================== */
@media (prefers-color-scheme: dark) {
    .mobile-nav {
        background: var(--bg-dark);
    }

    .mobile-nav-links a {
        color: var(--text-cosmic);
    }

    .mobile-nav-links a:hover,
    .mobile-nav-links a.active {
        background: rgba(102, 126, 234, 0.2);
    }

    .mobile-cta-bar {
        background: var(--bg-darker);
    }

    .mobile-cta-call {
        background: transparent;
    }

    .faq-item {
        background: var(--bg-card);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .faq-question:hover {
        background-color: rgba(255, 255, 255, 0.05);
    }
}

/* ===================================
   Print Responsive
   =================================== */
@media print {
    .container {
        max-width: 100%;
        padding: 0;
    }

    .section {
        padding: 20px 0;
    }

    h1 { font-size: 24pt; }
    h2 { font-size: 18pt; }
    h3 { font-size: 14pt; }

    body {
        padding-bottom: 0;
    }
}
