/**
 * FocusPoint UI.
 *
 * Only the pieces that are specific to picking a point live here; the dialog
 * chrome (head, body, side panel, buttons) is reused from smart-image-crop.css
 * so the two image dialogs cannot drift apart visually. That stylesheet is
 * namespaced `sic-` and deliberately avoids Bootstrap's .btn, because
 * css/styles.css redefines .btn-secondary globally as a full-width 18px block -
 * the same reason applies here, so nothing below leans on Bootstrap either.
 */

.fp-root {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 8px;
    border-radius: 10px;
    background: #f1f2f5;
}

/* Shrink-wraps the photo, so a percentage inside this box is a percentage of
   the image itself - that is what lets the JS treat pointer position, marker
   position and object-position as one and the same number. */
.fp-frame {
    position: relative;
    display: inline-block;
    line-height: 0;
    cursor: crosshair;
    touch-action: none;
    user-select: none;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(16, 20, 30, 0.12);
}

.fp-image {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 420px;
    -webkit-user-drag: none;
    user-select: none;
}

/* ---------------------------------------------------------------- marker -- */

.fp-marker {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: 0;
    padding: 0;
    transform: translate(-50%, -50%);
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 1px rgba(16, 20, 30, 0.35), 0 2px 8px rgba(16, 20, 30, 0.35);
    cursor: grab;
    backdrop-filter: blur(1px);
}

.fp-marker:active {
    cursor: grabbing;
}

/* While the focus still follows the pointer the marker is a light outline that
   glides along; once it is clicked into place it fills in, so "this is where it
   will stay" is visible without reading the hint. */
.fp-marker-locked {
    background: rgba(128, 0, 128, 0.35);
    border-color: #ffffff;
    box-shadow: 0 0 0 2px rgba(128, 0, 128, 0.9), 0 2px 10px rgba(16, 20, 30, 0.45);
}

.fp-marker:focus-visible {
    outline: 3px solid #800080;
    outline-offset: 3px;
}

/* The crosshair itself: two hairlines through the centre, so the exact pixel
   being chosen is visible even on a busy photo. */
.fp-marker::before,
.fp-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    background: #ffffff;
    box-shadow: 0 0 2px rgba(16, 20, 30, 0.6);
    transform: translate(-50%, -50%);
}

.fp-marker::before {
    width: 2px;
    height: 46px;
}

.fp-marker::after {
    width: 46px;
    height: 2px;
}

/* -------------------------------------------------------------- previews -- */

.fp-previews {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
    gap: 14px;
}

/* Each preview carries its own aspect-ratio inline, from the $fpShapes the page
   passed to the partial, so this wrapper must not impose a width: a cover photo
   wants the full panel, an avatar wants 150px, and the shape list decides. */
.fp-preview-item {
    min-width: 0;
}

.fp-preview-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.fp-preview {
    overflow: hidden;
    border: 1px solid #e4e7ec;
    border-radius: 8px;
    background: #f7f8fa;
}

.fp-preview img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* An avatar is never shown as a square on the site, so it must not be previewed
   as one: the box is clipped to a circle and the <img> inside still covers it,
   which is exactly how the page renders it. */
.fp-preview-round {
    border-radius: 50%;
}

@media (max-width: 575.98px) {
    .fp-image {
        max-height: 300px;
    }

    /* Side by side on a phone, where the panel sits under the photo and
       vertical space is the scarce one. Ratios stay as the page declared them;
       only the direction changes. */
    .fp-previews {
        flex-direction: row;
        align-items: flex-start;
    }

    .fp-preview-item {
        flex: 1 1 120px;
    }
}
