/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* ── Base ──────────────────────────────────────────────────────── */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #111;
    background: #fff;
    min-height: 100vh;
}

/* ── Nav ───────────────────────────────────────────────────────── */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 60px;
    border-bottom: 1px solid #f0f0f0;
    background: #fff;
}

.logo {
    font-size: 1.15em;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
    letter-spacing: -0.01em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-links a, .nav-btn {
    text-decoration: none;
    font-size: 0.92em;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: 8px;
    transition: all 0.18s;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.btn-ghost { color: #444; background: transparent; }
.btn-ghost:hover { background: #f4f4f4; color: #111; }
.nav-active { color: #667eea !important; font-weight: 600; }
.nav-credits-count {
    font-size: 0.88em;
    font-weight: 500;
    padding: 8px 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
}
.btn-primary:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(102,126,234,0.32);
}

/* ── Page wrapper ──────────────────────────────────────────────── */
.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 40px;
}

/* ── Section spacing ───────────────────────────────────────────── */
.section { padding: 80px 0; }
.section-sm { padding: 48px 0; }

/* ── Headings ──────────────────────────────────────────────────── */
h1 { font-size: 2.8em; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; }
h2 { font-size: 1.6em; font-weight: 700; }
h3 { font-size: 1em; font-weight: 700; }

.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ── Badge ─────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    background: #f0f0ff;
    color: #667eea;
    font-size: 0.72em;
    font-weight: 700;
    padding: 4px 13px;
    border-radius: 20px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Buttons (standalone, not nav) ────────────────────────────── */
.btn {
    display: inline-block;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.97em;
    padding: 13px 28px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.18s;
    font-family: inherit;
}

.btn-lg { padding: 15px 34px; font-size: 1.05em; }

.btn-solid {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
}
.btn-solid:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102,126,234,0.38);
}
.btn-solid:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-outline {
    color: #667eea;
    border: 2px solid #667eea;
    background: transparent;
}
.btn-outline:hover { background: #f0f0ff; }

.btn-subtle { background: #f2f2f2; color: #444; }
.btn-subtle:hover { background: #e8e8e8; }

/* ── Card ──────────────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 16px;
    border: 1.5px solid #ebebeb;
    padding: 28px;
}

/* ── Form elements ─────────────────────────────────────────────── */
label {
    display: block;
    font-size: 0.88em;
    font-weight: 600;
    color: #444;
    margin-bottom: 7px;
    letter-spacing: 0.01em;
}

input[type="text"], textarea, select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 9px;
    font-size: 0.97em;
    font-family: inherit;
    color: #111;
    background: #fff;
    transition: border-color 0.18s;
    outline: none;
}

input[type="text"]:focus,
textarea:focus,
select:focus { border-color: #667eea; }

textarea { resize: vertical; min-height: 90px; }

/* ── Upload area ───────────────────────────────────────────────── */
.upload-area {
    border: 2px dashed #c8c8f0;
    border-radius: 12px;
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafaff;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: #667eea;
    background: #f2f2ff;
}

.upload-icon { font-size: 2.4em; margin-bottom: 10px; }

.upload-area p { color: #666; font-size: 0.92em; line-height: 1.5; }
.upload-area .hint { color: #aaa; font-size: 0.82em; margin-top: 6px; }

#imageInput { display: none; }

#preview {
    width: 100%;
    margin-top: 16px;
    display: none;
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.1);
}

/* ── Spinner ───────────────────────────────────────────────────── */
.spinner {
    border: 3px solid #f0f0f0;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 0.85s linear infinite;
    margin: 0 auto 14px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ── Error ─────────────────────────────────────────────────────── */
.error-box {
    display: none;
    background: #fff5f5;
    color: #c0392b;
    padding: 13px 16px;
    border-radius: 9px;
    border-left: 4px solid #e74c3c;
    font-size: 0.92em;
    margin-top: 16px;
}

/* ── Result image ──────────────────────────────────────────────── */
#resultImage {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.12);
    margin-bottom: 16px;
    display: block;
}

/* ── Download button ───────────────────────────────────────────── */
.download-btn {
    display: block;
    text-align: center;
    text-decoration: none;
    padding: 13px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95em;
    background: #22c55e;
    color: #fff;
    transition: all 0.18s;
}

.download-btn:hover { background: #16a34a; transform: translateY(-1px); }

/* ── Footer ────────────────────────────────────────────────────── */
footer {
    border-top: 1px solid #f0f0f0;
    padding: 28px 60px;
    text-align: center;
    color: #aaa;
    font-size: 0.85em;
}

footer a {
    color: #aaa;
    text-decoration: none;
}

footer a:hover {
    color: #667eea;
}

/* ── Landing: Section header ───────────────────────────────────── */
.section-header {
    text-align: center;
    margin-bottom: 48px;
}

.section-label {
    display: inline-block;
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #667eea;
    margin-bottom: 12px;
}

.section-header h2 {
    margin-bottom: 12px;
}

.section-header p {
    color: #666;
    font-size: 1.05em;
    line-height: 1.6;
    max-width: 520px;
    margin: 0 auto;
}

/* ── Landing: Gallery ──────────────────────────────────────────── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.gallery-card {
    padding: 16px;
}

.gallery-prompt {
    font-size: 0.85em;
    color: #555;
    font-style: italic;
    margin-top: 12px;
    line-height: 1.5;
}

.gallery-row-label {
    font-size: 0.8em;
    font-weight: 700;
    color: #999;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 16px;
}

/* ── Landing: Before/after ─────────────────────────────────────── */
.before-after {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.before-after-panel {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.ba-label {
    font-size: 0.72em;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #aaa;
}

/* ── Landing: Placeholder image ────────────────────────────────── */
.placeholder-img {
    aspect-ratio: 4/3;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

/* Wall (top 58%) + floor (bottom 42%) for each room type */
.placeholder-img.room-living {
    background: linear-gradient(to bottom, #ddd8cc 0%, #ddd8cc 58%, #b8a888 58%);
}

.placeholder-img.room-bedroom {
    background: linear-gradient(to bottom, #ddd0d0 0%, #ddd0d0 58%, #b89898 58%);
}

.placeholder-img.room-kitchen {
    background: linear-gradient(to bottom, #d8e0d4 0%, #d8e0d4 58%, #aec09e 58%);
}

.placeholder-img.room-boho {
    background: linear-gradient(to bottom, #ece4d4 0%, #ece4d4 58%, #c8b490 58%);
}

.placeholder-img.room-office {
    background: linear-gradient(to bottom, #d8e4e8 0%, #d8e4e8 58%, #a4c0c8 58%);
}

.placeholder-img.room-midcentury {
    background: linear-gradient(to bottom, #e0d8cc 0%, #e0d8cc 58%, #b8a480 58%);
}

/* After variants: lighter, modern palette */
.placeholder-img.room-living.room-after {
    background: linear-gradient(to bottom, #eeebe4 0%, #eeebe4 58%, #d4c8b4 58%);
}

.placeholder-img.room-bedroom.room-after {
    background: linear-gradient(to bottom, #ede8e8 0%, #ede8e8 58%, #d4bcbc 58%);
}

.placeholder-img.room-kitchen.room-after {
    background: linear-gradient(to bottom, #eef2ec 0%, #eef2ec 58%, #ccdac4 58%);
}

/* Window light glow on all "after" rooms */
.placeholder-img.room-after::before {
    content: '';
    position: absolute;
    top: 7%;
    left: 50%;
    transform: translateX(-50%);
    width: 22%;
    height: 26%;
    background: rgba(255,255,255,0.6);
    border-radius: 3px;
    box-shadow: 0 0 20px 10px rgba(255,255,255,0.4);
}

.placeholder-label {
    font-size: 0.78em;
    font-weight: 600;
    color: rgba(0,0,0,0.3);
    letter-spacing: 0.04em;
    text-align: center;
    padding: 0 12px;
    position: relative;
    z-index: 1;
}

/* ── Landing: Capabilities ─────────────────────────────────────── */
.capabilities-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.capability-card {
    padding: 28px 24px;
}

.capability-icon {
    font-size: 1.8em;
    margin-bottom: 14px;
    display: block;
}

.capability-card h3 {
    margin-bottom: 8px;
    font-size: 1em;
}

.capability-card p {
    font-size: 0.88em;
    color: #666;
    line-height: 1.6;
}

/* ── Landing: Steps ────────────────────────────────────────────── */
.steps {
    display: flex;
    align-items: flex-start;
    gap: 0;
    position: relative;
}

.step {
    flex: 1;
    text-align: center;
    padding: 0 24px;
    position: relative;
}

.step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 24px;
    right: -2px;
    width: 4px;
    height: 2px;
    background: #e0e0f0;
    width: calc(100% - 48px);
    right: calc(-50% + 24px);
    top: 22px;
}

.step-number {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.1em;
    margin: 0 auto 16px;
    position: relative;
    z-index: 1;
}

.step h3 {
    margin-bottom: 8px;
    font-size: 1em;
}

.step p {
    font-size: 0.88em;
    color: #666;
    line-height: 1.6;
}

/* ── Landing: CTA Banner ───────────────────────────────────────── */
.cta-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 20px;
    padding: 64px 40px;
    text-align: center;
    color: #fff;
    margin-bottom: 80px;
}

.cta-banner h2 {
    font-size: 2em;
    margin-bottom: 12px;
    color: #fff;
}

.cta-banner p {
    font-size: 1.05em;
    opacity: 0.85;
    margin-bottom: 32px;
    line-height: 1.6;
}

.btn-white {
    background: #fff;
    color: #667eea;
}

.btn-white:hover {
    opacity: 0.92;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

/* ── Landing: Hero trust line ──────────────────────────────────── */
.hero-trust {
    font-size: 0.82em;
    color: #aaa;
    margin-top: 18px;
}

/* ── Landing: Responsive ───────────────────────────────────────── */
@media (max-width: 900px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .steps {
        flex-direction: column;
        align-items: center;
        gap: 32px;
    }

    .step:not(:last-child)::after {
        display: none;
    }

    .step {
        max-width: 320px;
        width: 100%;
    }
}

@media (max-width: 600px) {
    .gallery-grid {
        grid-template-columns: 1fr;
    }

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

    .before-after {
        grid-template-columns: 1fr 1fr;
    }

    .cta-banner {
        padding: 48px 24px;
    }

    .cta-banner h2 {
        font-size: 1.6em;
    }
}

/* ── Mobile global ──────────────────────────────────────────────── */
@media (max-width: 640px) {
    nav {
        padding: 14px 16px;
    }

    .nav-links {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }

    .nav-links::-webkit-scrollbar {
        display: none;
    }

    .nav-links a, .nav-btn {
        padding: 7px 12px;
        font-size: 0.85em;
        white-space: nowrap;
    }

    .page {
        padding: 0 16px;
    }

    footer {
        padding: 20px 16px;
    }
}
