/* ========================================
   RIHO CLEAN - 리호클린 입주청소
   Main Stylesheet - Additional Enhancements
   ======================================== */

/*
 * CSS Architecture:
 * 1. Variables (Design Tokens) - variables.css
 * 2. Base (Reset & Foundation) - base.css
 * 3. Components (Reusable UI Elements) - components.css
 * 4. Sections (Page Specific Styles) - sections.css
 * 5. Animations (Motion Design) - animations.css
 * 6. Responsive (Breakpoints) - responsive.css
 * 7. This file - Additional enhancements
 */

/* ========================================
   Additional Quality Enhancements
   ======================================== */

/* ===== Enhanced Form Validation States ===== */
.form-input.has-error,
.form-select.has-error {
    border-color: var(--color-danger);
    animation: shake 0.5s ease;
}

.form-input.has-success,
.form-select.has-success {
    border-color: var(--color-success);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===== Enhanced Button States ===== */
.btn:disabled,
.btn.loading {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: var(--space-2);
}

/* ===== Enhanced Card Hover Effects ===== */
.reality-card,
.doubt-card,
.method-card,
.review-card,
.pricing-card {
    will-change: transform;
    backface-visibility: hidden;
}

/* ===== Image Loading States ===== */
.hero-visual img {
    opacity: 0;
    transition: opacity 0.4s ease;
}

.hero-visual img.loaded {
    opacity: 1;
}

/* ===== Focus Visible Enhancement ===== */
.btn:focus-visible,
.tab-btn:focus-visible,
.faq-question:focus-visible,
.nav-menu a:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

/* ===== Enhanced Section Transitions ===== */
.section-header {
    will-change: opacity, transform;
}

.section-header.is-visible {
    opacity: 1 !important;
    transform: translateY(0) !important;
}

/* ===== High Contrast Mode Support ===== */
@media (prefers-contrast: high) {
    :root {
        --color-primary: #1a3a1f;
        --color-primary-dark: #0d2011;
        --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.2);
        --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.3);
    }
    
    .btn-primary {
        border: 2px solid var(--color-white);
    }
}

/* ===== Smooth Color Transitions ===== */
a,
button,
.btn,
.tab-btn,
.faq-question,
.nav-menu a {
    transition-property: color, background-color, border-color, box-shadow, transform;
    transition-duration: 200ms;
    transition-timing-function: var(--ease-out);
}

/* ===== Selection Enhancement ===== */
::selection {
    background-color: rgba(61, 90, 69, 0.3);
    color: var(--color-text);
}

/* ===== Better Text Rendering ===== */
.hero h1,
.section-title,
.diy-text h2,
.solution h2,
.guarantee h2,
.final-text h2 {
    text-wrap: balance;
}

/* ===== Container Query Support (Progressive) ===== */
@supports (container-type: inline-size) {
    .pricing-cards,
    .reviews-grid,
    .reality-grid {
        container-type: inline-size;
    }
}

/* ===== Safe Area Insets (Mobile Notches) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
    .floating-cta {
        bottom: calc(var(--space-8) + env(safe-area-inset-bottom));
    }
    
    .footer {
        padding-bottom: calc(var(--space-8) + env(safe-area-inset-bottom));
    }
}

/* ===== Print Enhancements ===== */
@media print {
    .hero,
    .reality,
    .diy-limit,
    .doubt,
    .solution,
    .scope,
    .method,
    .before-after,
    .reviews,
    .difference,
    .pricing,
    .guarantee,
    .area,
    .faq,
    .final-cta {
        page-break-inside: avoid;
    }
    
    .section-title {
        font-size: 18pt;
    }
    
    .btn {
        display: none !important;
    }
    
    .pricing-card.featured {
        border: 2px solid #000 !important;
    }
}

/* ===== Korean Typography Optimization ===== */
body {
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* Optimize line breaks for Korean text */
.hero h1,
.section-description,
.reality-card p,
.diy-item p,
.doubt-card p,
.solution-item p,
.review-text,
.faq-answer p {
    word-break: keep-all;
}

/* ===== GPU Acceleration Hints ===== */
.hero-bg,
.floating-cta,
.modal,
.nav-menu {
    transform: translateZ(0);
}

/* ===== Prevent FOUC (Flash of Unstyled Content) ===== */
html:not(.fonts-loaded) body {
    visibility: hidden;
}

html.fonts-loaded body {
    visibility: visible;
}

/* Fallback - show content after 2s even if fonts not loaded */
@keyframes showContent {
    to { visibility: visible; }
}

html:not(.fonts-loaded) body {
    animation: showContent 0s 2s forwards;
}
