/* style.css, part 8 of 13: the background-removal preview (src/background-preview.js).
   A contiguous range of the pre-M7 style.css, linked from index.html in
   source order so the cascade is unchanged; see src/tokens.css. */

/* ============================================================
   THE BACKGROUND-REMOVAL PREVIEW — src/background-preview.js, BRIEF-032.

   A pop-out that shows exactly which pixels "Remove background
   automatically" and Picture colours currently drop, on a checkerboard —
   the universal transparency convention. Structurally the same dialog as
   the ⓘ note above (.in-* — role="dialog", scrim, Escape, Tab loop, focus
   return), deliberately not reinvented; only the body differs, a picture
   instead of a term/detail list.

   Tokens only, same rule as the ⓘ note's own comment: every font-size,
   font-weight, line-height, letter-spacing, border-radius and font-family
   below is one of the family ladder's variables — tests/type-ladder-gate.mjs
   fails a literal that is not a token or a named exception, and this pattern
   is not in that table.
   ============================================================ */

/* A small text button, not an icon — this one names the exact thing it
   opens, so no separate aria-label is needed. Sits on its own line rather
   than inside .check-row: no existing check row in this page carries a
   third control and this one only ever applies to one of them. */
.bgprev-open {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 0.1rem 0 0.35rem;
    padding: 0.4rem 0.9rem;
    border: 2px solid var(--accent-color);
    border-radius: var(--radius-chip);
    background: var(--c-white);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: var(--fw-strong);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background var(--dur-160) ease;
}
.bgprev-open:hover { background: var(--c-pink-50); color: var(--accent-text); }
.bgprev-open:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; }

.bgprev-root {
    position: fixed;
    inset: 0;
    /* Under the per-section guide (9600) and the ⓘ note (9500), over
       everything else — the two are never open at once (each takes focus
       from the other) so only one of z-index and "which one wins" needs an
       answer. This panel is opened from a control the ⓘ note also sits
       beside, so it sits just under the note's own layer. */
    z-index: 9400;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.bgprev-scrim {
    position: absolute;
    inset: 0;
    background: var(--scrim-color);
}
.bgprev-card {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: min(78vh, 640px);
    overflow-y: auto;
    background: var(--card-bg);
    border: 2px solid var(--border-card-open);
    border-radius: var(--radius-dialog);
    box-shadow: 0 18px 44px var(--shadow-soft);
    padding: 1.15rem 1.25rem 1rem;
}
.bgprev-title {
    margin: 0 0 0.75rem;
    font-family: var(--font-display);
    font-size: var(--fs-lg);
    font-weight: var(--fw-strong);
    letter-spacing: var(--tracking-title);
    color: var(--text-primary);
}
.bgprev-title:focus-visible {
    outline: 3px solid var(--accent-text);
    outline-offset: 4px;
    border-radius: var(--radius-inset);
}
.bgprev-body { margin: 0; }
/* THE CHECKERBOARD — the universal transparency convention. A neutral
   mid-grey against white so it reads clearly against any picture without
   competing with the app's own pink/lavender accents. Not a tracked
   property (background-image/-size are outside the six the type ladder
   gate holds), so no token is owed here. */
.bgprev-canvas-wrap {
    border-radius: var(--radius-control);
    border: 1.5px solid var(--border-color);
    overflow: hidden;
    background-image:
        linear-gradient(45deg, var(--c-grey-300) 25%, transparent 25%),
        linear-gradient(-45deg, var(--c-grey-300) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--c-grey-300) 75%),
        linear-gradient(-45deg, transparent 75%, var(--c-grey-300) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    background-color: var(--c-white);
}
.bgprev-canvas {
    display: block;
    width: 100%;
    height: auto;
}
.bgprev-caption {
    margin: 0.65rem 0 0;
    font-size: var(--fs-sm);
    line-height: var(--lh-base);
    color: var(--text-primary);
}
.bgprev-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}
.bgprev-btn {
    min-height: 44px;
    padding: 0.5rem 1.3rem;
    border-radius: var(--radius-chip);
    border: 2px solid var(--accent-color);
    background: var(--c-white);
    color: var(--text-primary);
    font-family: var(--font-display);
    font-weight: var(--fw-strong);
    font-size: var(--fs-sm);
    cursor: pointer;
    transition: background var(--dur-160) ease;
}
.bgprev-btn:hover { background: var(--c-pink-50); color: var(--accent-text); }
