/* ============================================
   Photo Studio — Multi-Photo + Garage-Door Slider
   ============================================ */

.photo-studio-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem 1.5rem 4rem;
}

.photo-studio-page h1 {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    /* Light — sits on dark galaxy background */
    color: var(--color-text);
}

.ps-subtitle {
    /* Light — sits on dark galaxy background */
    color: var(--color-text-secondary);
    font-size: 0.88rem;
    margin-bottom: 1.5rem;
}

/* --- Upload Zone (empty state) ---
   Re-skinned to the unified suite `.s-dropzone` (editor-suite.css). The only
   surviving bespoke rule is the inner placeholder wrapper, kept as a simple
   centred column so the icon/title/sub/Browse stack reads correctly inside the
   suite dropzone. The dashed border, hover, and `.is-dragover` state now come
   from suite. */
.ps-upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}


/* --- Edit Type Selector ---
   Re-skinned to the unified suite `.s-choice-grid` / `.s-choice-card`
   (editor-suite.css). No bespoke type-picker rules remain. */


/* --- Multi-Photo Cards Grid (input stage) --- */
.ps-photo-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 0.25rem;
}
.ps-photo-cards.is-dragover {
    outline: 2px dashed var(--color-text);
    outline-offset: 6px;
    border-radius: var(--border-radius);
}

.ps-photo-card {
    border: 1px solid var(--color-card-border);
    border-radius: var(--border-radius-sm);
    background: var(--color-bg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.ps-photo-preview {
    position: relative;
    aspect-ratio: 4 / 3;
    background: #000;
    overflow: hidden;
}
.ps-photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.ps-photo-remove {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}
.ps-photo-remove:hover {
    background: rgba(0, 0, 0, 0.85);
}
.ps-photo-index {
    position: absolute;
    top: 0.4rem;
    left: 0.4rem;
    background: rgba(255, 255, 255, 0.92);
    color: var(--color-text);
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.ps-photo-options {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.ps-photo-option-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    margin-top: 0.4rem;
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.ps-photo-option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.ps-photo-opt {
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 550;
    border: 1px solid var(--color-card-border);
    border-radius: 8px;
    background: var(--color-bg);
    color: var(--color-text);
    cursor: pointer;
    font-family: var(--font-primary);
    transition: all var(--transition-fast);
}
.ps-photo-opt:hover {
    border-color: #ccc;
    background: var(--color-card-bg);
}
.ps-photo-opt.selected {
    background: var(--color-text);
    color: var(--color-bg);
    border-color: var(--color-text);
}
.ps-photo-option-hint {
    font-size: 0.68rem;
    line-height: 1.4;
    color: var(--color-text-secondary);
    margin-top: 0.4rem;
}

.ps-btn-add-more {
    margin-top: 0.75rem;
}


/* --- Phase 2B engine toggle ---
   Box / border / hover now come from the unified suite `.s-check-row`. These
   rules only (a) top-align the row because its description is multi-line (suite
   default is centre, which floats the checkbox to the middle of a tall block),
   add the top gap, and (b) style the inner title/badge/desc content the row
   still carries. */
.ps-phase2b-toggle.s-check-row {
    align-items: flex-start;
    margin-top: 1.1rem;
}
.ps-phase2b-toggle input[type="checkbox"] {
    flex: 0 0 auto;
    margin-top: 0.15rem;
    accent-color: var(--s-accent, #0a0a0a);
}
.ps-phase2b-text {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    /* allow the description to wrap instead of forcing the row wider */
    min-width: 0;
}
.ps-phase2b-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text, #0a0a0a);
}
.ps-phase2b-badge {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.05rem 0.45rem;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #777;
    background: #ebebe7;
    border-radius: 50px;
    vertical-align: middle;
}
.ps-phase2b-desc {
    font-size: 0.75rem;
    color: var(--color-text-muted, #999);
    line-height: 1.4;
}

/* --- Generate Button + Time Note ---
   Sizing / full-width / disabled state come from suite
   (.s-btn-primary.s-btn-lg.s-btn-block). Only the top gap is bespoke. */
.ps-btn-generate {
    margin-top: 1.25rem;
}
.ps-time-note {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: 0.5rem;
}


/* --- Loading State (design-system staged checklist) ---
   The dead spinner is gone; the working state is now the .s-stages checklist
   (editor-suite.css) inside a calm card shell, with a shimmer banner up top and
   the .s-stages-bar progress fill. Only page-specific glue lives here — the
   stage rows, the bar, and the shimmer are the shared .s-* components. */
.ps-loading-shell {
    max-width: 460px;
    margin: 2.5rem auto;
    padding: 1.5rem;
    background: var(--s-surface);
    border: 1px solid var(--s-border);
    border-radius: var(--s-r-xl);
    box-shadow: var(--s-shadow-sm);
}
.ps-loading-shimmer {
    position: relative;
    aspect-ratio: 3 / 2;
    border-radius: var(--s-r-lg);
    display: grid;
    place-items: center;
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.ps-loading-ring {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 3px solid rgba(10, 10, 10, 0.12);
    border-top-color: var(--s-text);
    animation: ps-spin 0.9s linear infinite;
}
@keyframes ps-spin { to { transform: rotate(360deg); } }
.ps-loading-status {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--s-text);
    margin-bottom: 0.9rem;
}
.ps-loading-detail {
    font-size: 0.78rem;
    color: var(--s-text-3);
    margin-top: 0.8rem;
    min-height: 1.1em;
}
.ps-loading-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 0.85rem;
    font-size: 0.72rem;
    color: var(--s-text-3);
}
@media (prefers-reduced-motion: reduce) {
    .ps-loading-ring { animation: none; }
}


/* --- Result view header (eyebrow → h1 → lede rhythm) --- */
.ps-result-head {
    margin-bottom: 1.25rem;
}
.ps-result-head .s-h1 {
    margin: 0.5rem 0 0;
}
.ps-result-title {
    /* The result h1 sits on the suite light surface; the page's bespoke h1
       colour rule above targets only `.photo-studio-page h1`, so the suite
       `.s-h1` colour applies here automatically. */
    margin-bottom: 0;
}

/* --- Result grid cards ---
   The grid container, card shell, media box, badge, hover row and meta are the
   shared .s-result-* components (editor-suite.css). The before/after slider
   inside each .s-result-media is the shared .s-compare. Only the in-card hover
   buttons + the result body (analysis, refine, downloads) need page glue. */

/* hover action buttons over the media (Compare + Download) */
.ps-hov-btn {
    flex: 1;
    height: 34px;
    border: 0;
    border-radius: var(--s-r-sm);
    background: rgba(255, 255, 255, 0.92);
    color: var(--s-text);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 650;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    transition: background var(--s-t-fast);
}
.ps-hov-btn:hover { background: #fff; }
.ps-hov-btn svg { width: 14px; height: 14px; }
.ps-hov-btn.ps-hov-btn-sq { flex: 0 0 34px; padding: 0; }

/* the body under the media: meta row + audit + analysis + refine + downloads */
.ps-result-body {
    padding: 11px 14px 14px;
}
.ps-result-body .ps-result-meta {
    padding: 0 0 0.6rem;
}

/* error result card (kept distinct from the media cards) */
.ps-result-error-card {
    border: 1px solid var(--s-danger-border);
    border-radius: var(--s-r-lg);
    background: var(--s-danger-soft);
    padding: 1rem;
}
.ps-result-error-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}
.ps-result-idx {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--s-text);
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.ps-result-error-msg {
    font-size: 0.8rem;
    color: var(--s-danger);
    line-height: 1.45;
}


/* --- Lightbox glue (panel/head/body/foot are shared .s-lightbox-*) --- */
.ps-lightbox-name {
    font-weight: 660;
    font-size: 0.95rem;
    color: var(--s-text);
}
.ps-lightbox-spacer { flex: 1; }
.ps-lightbox-input { flex: 1; }
/* The big compare slider inside the lightbox body caps its height so the panel
   never overflows on short viewports; the segmented toggle sits beneath it. */
#ps-lightbox-body .s-compare {
    max-height: 64vh;
    margin: 0 auto;
}

/* Before / Compare / After segmented toggle (ink-filled active = the
   approved prototype's hero move). Monochrome ink chrome. */
.ps-compare-seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    margin: 14px auto 0;
    background: var(--s-surface-3);
    border-radius: var(--s-r-pill);
}
.ps-compare-seg-wrap { display: flex; justify-content: center; }
.ps-compare-seg button {
    appearance: none;
    border: 0;
    background: transparent;
    height: 30px;
    padding: 0 15px;
    border-radius: var(--s-r-pill);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--s-text-2);
    cursor: pointer;
    transition: color var(--s-t-fast), background var(--s-t-fast);
}
.ps-compare-seg button:hover { color: var(--s-text); }
.ps-compare-seg button.is-on {
    background: var(--s-accent);
    color: var(--s-on-accent);
    box-shadow: var(--s-shadow-xs);
}
/* centre the toggle under the slider */
#ps-lightbox-body { text-align: center; }
#ps-lightbox-body .s-compare { text-align: left; }
@media (prefers-reduced-motion: reduce) {
    .ps-compare-seg button { transition: none; }
}


/* --- Honest audit flag (shown only when the AI inspector wasn't satisfied) ---
   A genuine warning state → semantic --s-warn (the one sanctioned non-ink use). */
.ps-audit-flag {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin: 0 0 0.85rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--s-warn-border);
    border-left: 3px solid var(--s-warn);
    border-radius: var(--s-r-sm);
    background: var(--s-warn-soft);
}
.ps-audit-flag-icon {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border-radius: 50%;
    background: var(--s-warn);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}
.ps-audit-flag-text {
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--s-text);
}
.ps-audit-flag-text strong {
    font-weight: 700;
    color: var(--s-warn);
}


/* --- Analysis Details --- */
.ps-analysis-details {
    margin-bottom: 0.75rem;
    border: 1px solid var(--s-border);
    border-radius: var(--s-r-sm);
    overflow: hidden;
}
.ps-analysis-details summary {
    padding: 0.55rem 0.85rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    background: var(--s-surface-2);
    color: var(--s-text-2);
    transition: background var(--s-t-fast);
}
.ps-analysis-details summary:hover {
    background: var(--s-surface-3);
}
.ps-analysis-text {
    padding: 0.75rem 0.9rem;
    font-size: 0.74rem;
    font-family: var(--s-font);
    line-height: 1.6;
    color: var(--s-text-2);
    white-space: pre-wrap;
    word-wrap: break-word;
    background: var(--s-surface);
}


/* --- Per-Card Actions --- */
.ps-result-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}


/* --- Compliance Disclaimer (top of results) ---
   A required legal notice → semantic --s-warn so it reads as "attention". */
.ps-disclaimer {
    border-left: 4px solid var(--s-warn);
    background: var(--s-warn-soft);
    padding: 0.85rem 1.1rem;
    border-radius: 0 var(--s-r-md) var(--s-r-md) 0;
    margin-bottom: 1rem;
}
.ps-disclaimer strong {
    display: block;
    font-size: 0.82rem;
    color: var(--s-warn);
    margin-bottom: 0.25rem;
}
.ps-disclaimer p {
    font-size: 0.78rem;
    color: var(--s-text-2);
    line-height: 1.5;
}


/* --- MLS Snippet --- */
.ps-mls-snippet {
    margin-bottom: 1.25rem;
    padding: 0.8rem 0.9rem;
    background: var(--s-surface-2);
    border: 1px solid var(--s-border);
    border-radius: var(--s-r-md);
}
.ps-mls-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--s-text);
    margin-bottom: 0.5rem;
}
.ps-mls-hint {
    font-weight: 400;
    color: var(--s-text-3);
    font-size: 0.72rem;
}
.ps-mls-row {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.ps-mls-text {
    flex: 1;
    font-family: var(--font-primary);
    font-size: 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-card-border);
    border-radius: 6px;
    padding: 0.5rem 0.65rem;
    line-height: 1.5;
    color: var(--color-text);
    user-select: all;
}


/* --- Bottom Actions --- */
.ps-actions {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}


/* --- Responsive --- */
@media (max-width: 640px) {
    .ps-actions {
        flex-direction: column;
    }
    .ps-actions .btn-primary,
    .ps-actions .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    .photo-studio-page {
        padding: 1.5rem 1rem 3rem;
    }
    .ps-photo-cards {
        grid-template-columns: 1fr;
    }
    /* The full-width Generate button carries a long dynamic label in the
       Lights-on twilight state ("Circle your home on N photos to continue").
       Suite `.s-btn` is nowrap + fixed-height by default, which would clip /
       spill that label on a phone. Let it wrap cleanly inside the 100%-width
       button so nothing ever runs off-screen at 390px. */
    .ps-btn-generate.s-btn {
        height: auto;
        min-height: 48px;
        padding-top: 0.7rem;
        padding-bottom: 0.7rem;
        white-space: normal;
        line-height: 1.3;
    }
    /* Title + History button: let the heading shrink/wrap rather than push the
       button off the row on the narrowest screens. */
    .ps-header-row h1 {
        font-size: 1.35rem;
        min-width: 0;
        overflow-wrap: anywhere;
    }
}

/* --- Header row: title + history button --- */
.ps-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.25rem;
}
.ps-header-row h1 {
    margin-bottom: 0;
}

/* --- History grid --- */
.ps-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}
.ps-history-card {
    border: 1px solid var(--color-card-border);
    border-radius: var(--border-radius);
    background: var(--color-card-bg);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--transition-fast);
    position: relative;
}
.ps-history-card:hover {
    border-color: #999;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.ps-history-thumb {
    width: 100%;
    aspect-ratio: 3 / 2;
    background: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}
.ps-history-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.ps-history-meta {
    padding: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.ps-history-type {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #f0f0f0;
    font-weight: 600;
}
.ps-history-type.twilight { background: #fde9ef; color: #a33466; }
.ps-history-type.staging  { background: #e6f0fc; color: #1f5695; }
.ps-history-date {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
}
.ps-history-delete {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    background: rgba(255,255,255,0.85);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 50%;
    width: 26px;
    height: 26px;
    line-height: 0;
    cursor: pointer;
    font-size: 1rem;
    color: #333;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ps-history-delete:hover { background: #fff; color: #a33; }
.ps-history-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 2rem;
    color: var(--color-text-secondary);
}

/* --- Edit Chat / Refine (per result card) ---
   Sits inside .ps-result-body. Monochrome ink chrome: the input is the shared
   .s-input; the progress bar is ink (not the old blue→purple gradient). A thin
   divider separates it from the analysis above. */
.ps-edit-chat {
    margin-top: 0.9rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--s-border);
}
.ps-edit-chat-label {
    display: block;
    font-size: 0.69rem;
    font-weight: 700;
    color: var(--s-text-3);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ps-edit-chat-row {
    display: flex;
    gap: 0.5rem;
}
/* The input carries .s-input for its border/radius/focus; this only sets the
   flex behaviour so it fills the row beside the Send button. */
.ps-edit-chat-input {
    flex: 1;
    min-width: 0;
}
.ps-edit-chat-status {
    margin: 0.4rem 0 0;
    font-size: 0.75rem;
    color: var(--s-text-3);
    min-height: 1em;
}
.ps-edit-chat-progress {
    margin-top: 0.6rem;
    height: 6px;
    background: var(--s-surface-3);
    border-radius: var(--s-r-pill);
    overflow: hidden;
}
.ps-edit-chat-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--s-accent);
    border-radius: var(--s-r-pill);
    transition: width 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ── Subject-outline ("Circle your home") draw overlay ───────────────── */
.ps-subject-clear {
    color: var(--color-text-secondary);
}
/* Lights-on REQUIRES a circled subject — flag the un-drawn state so it reads
   as a required action, not an optional extra. */
.ps-req-flag {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.05rem 0.4rem;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #b42318;
    background: #fee4e2;
    border-radius: 999px;
    vertical-align: middle;
}
.ps-subject-btn--needed {
    border-color: #f5a3a3 !important;
    background: #fff5f5 !important;
    color: #b42318 !important;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}
.ps-subject-btn--needed:hover {
    background: #ffecec !important;
}
.ps-outline-overlay {
    position: fixed;
    inset: 0;
    z-index: 220;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.ps-outline-modal {
    background: var(--color-bg, #fff);
    border-radius: var(--border-radius, 14px);
    padding: 1.1rem 1.1rem 1rem;
    max-width: 94vw;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.4);
}
.ps-outline-head h3 {
    margin: 0 0 0.2rem;
    font-size: 1rem;
    font-weight: 650;
    color: var(--color-text);
}
.ps-outline-head p {
    margin: 0;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--color-text-secondary);
    max-width: 42rem;
}
.ps-outline-stage {
    position: relative;
    line-height: 0;
    align-self: center;
}
.ps-outline-img {
    display: block;
    max-width: 86vw;
    max-height: 64vh;
    border-radius: var(--border-radius-sm, 8px);
    user-select: none;
    -webkit-user-drag: none;
}
.ps-outline-canvas {
    position: absolute;
    top: 0;
    left: 0;
    cursor: crosshair;
    touch-action: none;
}
.ps-outline-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}
