.photo-profile-help {
    color: var(--muted);
}

.photo-hero-apercu {
    display: grid;
    flex: 1;
    place-items: center;
    background: var(--bg);
}

.photo-hero-visage {
    width: 76%;
    aspect-ratio: 1;
    padding: 12%;
    border: 2px dashed var(--accent);
    border-radius: 50%;
    color: var(--accent-dark);
    background: var(--accent-soft);
}

.photo-hero-palette i { border: 1px solid var(--border); }
.photo-hero-palette i:nth-child(1) { background: #f8fafc; }
.photo-hero-palette i:nth-child(2) { background: #e0e7ff; }
.photo-hero-palette i:nth-child(3) { background: #334155; }

.photo-profile-inputs,
.photo-profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.photo-profile-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
    padding: .45rem .85rem;
    border: 1px solid var(--border);
    border-radius: .65rem;
    background: var(--surface, transparent);
    color: var(--fg);
    cursor: pointer;
    font-weight: 650;
}

.photo-profile-inputs .photo-profile-button {
    flex: 1 1 9rem;
}

.photo-profile-button input[type="file"] {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.photo-profile-button:focus-visible,
.photo-profile-button:focus-within,
.photo-profile-stage:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.photo-profile-button:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.photo-profile-help,
.photo-profile-status {
    margin-block: .55rem;
    font-size: .9rem;
}

.photo-profile-status:empty {
    display: none;
}

.photo-profile-editor,
.photo-profile-controls {
    display: grid;
    gap: .8rem;
}

.photo-profile [hidden] {
    display: none !important;
}

.photo-profile-stage {
    height: var(--photo-stage-height);
    overflow: hidden;
    border-radius: .65rem;
    background: #1d2432;
}

/* Le nouveau cadre est mesuré à sa taille réelle avant de remplacer le cadre actif. */
.photo-profile-preview { position: relative; }
.photo-profile-stage.is-pending {
    position: absolute;
    inset: 0 0 auto;
    visibility: hidden;
    pointer-events: none;
}

.photo-profile-editor {
    --photo-stage-height: clamp(230px, 58vw, 400px);
    --photo-sticky-top: 5.5rem;
}

.photo-profile-stage > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.photo-profile-stage .cropper-view-box {
    position: relative;
}

.photo-profile-retouch-preview {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.photo-profile-retouch {
    min-inline-size: 0;
    margin: 0;
    padding: .65rem .8rem .3rem;
    border: 1px solid var(--border);
    border-radius: .65rem;
}

.photo-profile-retouch legend,
.photo-profile-retouch-details summary {
    font-weight: 650;
}

.photo-profile-retouch .photo-profile-actions {
    margin-block-end: .65rem;
}

.photo-profile-retouch-details summary {
    padding-block: .6rem;
    cursor: pointer;
}

.photo-profile-button[aria-pressed="true"] {
    border-color: var(--accent);
    box-shadow: inset 0 0 0 1px var(--accent);
}

.photo-profile-stage .cropper-face::after {
    position: absolute;
    inset: 0;
    border: 1px dashed #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 1px #0008;
    content: '';
    pointer-events: none;
}

.photo-profile-range {
    display: grid;
    font-size: .92rem;
}

.photo-profile-range span {
    display: flex;
    justify-content: space-between;
}

.photo-profile-range input {
    width: 100%;
    min-height: 44px;
    margin: 0;
    accent-color: var(--accent);
}

.photo-profile-primary {
    width: 100%;
    border-color: var(--accent);
    background: var(--accent);
    color: var(--on-brand, #fff);
}

.photo-profile-download {
    align-self: end;
}

@media (min-width: 700px) {
    .photo-profile-editor {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
        gap: 1.35rem;
    }
}

@media (min-width: 700px) and (min-height: 440px) {
    .photo-profile-editor {
        --photo-stage-height: clamp(220px, 53svh, 400px);
    }

    .photo-profile-preview {
        position: sticky;
        align-self: start;
        inset-block-start: max(var(--photo-sticky-top), calc((100svh - var(--photo-stage-height)) / 2));
    }
}

@media (max-width: 699px) and (min-height: 520px) {
    .photo-profile-editor {
        --photo-stage-height: clamp(160px, 31svh, 255px);
    }

    .photo-profile-preview {
        position: sticky;
        inset-block-start: var(--photo-sticky-top);
        z-index: 1;
        background: var(--card, var(--bg, #fff));
        display: flow-root;
    }

    .photo-profile-controls :is(button, input, summary) {
        scroll-margin-block-start: calc(var(--photo-sticky-top) + var(--photo-stage-height) + 4.5rem);
    }
}

.photo-profile-swatches { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.photo-profile-swatch { width: 2rem; height: 2rem; border-radius: 9999px; border: 2px solid #cbd5e1; cursor: pointer; }
.photo-profile-swatch[aria-pressed="true"] { border-color: #1d4ed8; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #1d4ed8; }
.photo-profile-swatch[data-bg-color="#f8fafc"] { background: #f8fafc; }
.photo-profile-swatch[data-bg-color="#e2e8f0"] { background: #e2e8f0; }
.photo-profile-swatch[data-bg-color="#e0e7ff"] { background: #e0e7ff; }
.photo-profile-swatch[data-bg-color="#f5f0eb"] { background: #f5f0eb; }
.photo-profile-swatch[data-bg-color="#334155"] { background: #334155; }
.photo-profile-swatch-custom input { width: 2rem; height: 2rem; border: 0; padding: 0; background: none; cursor: pointer; }
