/* ══════════════════════════════════════════════════════
   Cutiora — css/frames-maker.css
   Styles that belong to Frames Maker only (prefix fm-). Step 1 is the shared
   "Remove the background" step and takes its look from css/sticker-maker.css
   (same ids, same classes); the sm-* buttons, tabs and chips are reused too.
   The photo spots are Shape Frames' own boxes and library (css/shape-frames.css,
   sf-* classes — loaded by the page on purpose). Only what is new lives here.
   ══════════════════════════════════════════════════════ */

#wFmStep2 { flex-direction: column; }   /* display:flex is set by js (goStep) when the step is shown */

.fm-editor { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 100%; }

/* ── the frame picture + the spots. Size is set by js (the picture's own proportions, fitted to the card);
   the layer is exactly as big as the picture, so a spot's place is a fraction of it (as in Shape Frames).
   Checkerboard = what is see-through (where the photo of a spot will show, and the empty room around). ── */
.fm-wrap {
  position: relative; max-width: 100%; overflow: hidden;
  border: 3px solid #2c2c2c; border-radius: 12px; box-sizing: content-box;
  background-color: #fff;
  background-image: conic-gradient(#e9e6ee 25%, #fff 0 50%, #e9e6ee 0 75%, #fff 0);
  background-size: 20px 20px;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.fm-art { display: block; width: 100%; height: 100%; }
.fm-layer { position: absolute; inset: 0; touch-action: pan-y; }
.fm-layer.sf-active { touch-action: none; }   /* a spot is selected: every finger on the picture belongs to the editor */
/* the spot's photo sits UNDER the frame picture in the saved file; on screen the frame picture has a hole
   exactly where the spot is, so drawing the spot on top looks the same (and keeps its handles reachable) */
.fm-layer .sf-frame .wst-flip { display: none !important; }

/* drawing a spot by hand: a canvas over everything that takes the finger only in that mode */
.fm-spotdraw { position: absolute; inset: 0; width: 100%; height: 100%; display: none; }
.fm-wrap.fm-drawing .fm-spotdraw { display: block; touch-action: none; cursor: crosshair; }
.fm-wrap.fm-drawing .fm-layer { pointer-events: none; }
.fm-drawbar { display: none; justify-content: center; width: 100%; }
.fm-drawbar.show { display: flex; flex-direction: column; align-items: center; gap: 8px; }
/* Freehand / Straight lines (item 287) — in the hole's draw bar and above the frame's drawing pad */
.fm-pen-edit[hidden], .fm-pen-final[hidden] { display: none; }   /* the shape editor (item 288) */
.fm-pen-use { background: #4CAF50; color: #fff; }
.fm-pen-use:not(:disabled):hover { background: #43a047; }
.fm-pad-box .fm-pen-modes, .fm-drawbar .fm-pen-modes { justify-content: center; }
/* on the frame's pad: the editing buttons UNDER the drawing box (the box stays where the eye is) */
.fm-pad-box .fm-pen-modes { order: 1; } .fm-pad-box #wFmPadHint { order: 2; } .fm-pad-box .fm-pad-wrap { order: 3; }
.fm-pad-box .fm-pen-edit { order: 4; } .fm-pad-box .fm-pen-final { order: 5; } .fm-pad-box > .sm-actions:last-child { order: 6; }

/* the person's drawing: always shown on top (even over a hole); it takes the fingers only in the Draw tab,
   then the spots ignore them (as Shape Frames' drawing layer) */
.fm-draw { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
.fm-wrap.fm-drawtab .fm-draw { pointer-events: auto; touch-action: none; cursor: crosshair; }
.fm-wrap.fm-drawtab .fm-layer { pointer-events: none; }
#wFmPanelDraw .sm-opt input[type=range] { width: 110px; }
#wFmDrawColor { width: 34px; height: 34px; border: 2px solid #2c2c2c; border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.fm-editor.fm-drawtab #wFmUndo, .fm-editor.fm-drawtab #wFmRedo { display: none; }   /* the Draw tab has its own Undo (as in Sticker Maker / Shape Frames) */

/* ── library ── */
.fm-count { margin: 0 0 8px; text-align: center; font: 700 12px 'Nunito', sans-serif; color: #888; }
.sf-shape.fm-own .fm-own-ico { font-size: 26px; line-height: 40px; }
.sf-shape.fm-own { background: #fffdf3; border-style: dashed; }

/* ── step 1: Crop (item 282; js/cutout-step.js). Kept here, not in sticker-maker.css, because only Frames
   Maker has the Crop tool for now — move these rules there if Sticker Maker gets it too. ── */
#wSmCrop {
  position: absolute; left: 0; top: 0; z-index: 4; box-sizing: border-box;
  border: 2px solid #fff; outline: 1.5px solid #2c2c2c;
  box-shadow: 0 0 0 9999px rgba(30, 24, 40, .55);           /* everything outside the box is dimmed */
  background-image:                                          /* thirds, to help place the subject */
    linear-gradient(to right, transparent 33.1%, rgba(255,255,255,.55) 33.1% 33.6%, transparent 33.6% 66.4%, rgba(255,255,255,.55) 66.4% 66.9%, transparent 66.9%),
    linear-gradient(to bottom, transparent 33.1%, rgba(255,255,255,.55) 33.1% 33.6%, transparent 33.6% 66.4%, rgba(255,255,255,.55) 66.4% 66.9%, transparent 66.9%);
  cursor: move; touch-action: none;
}
#wSmCrop[hidden] { display: none; }
.sm-crop-h {
  position: absolute; width: 20px; height: 20px; box-sizing: border-box;
  background: #fff; border: 3px solid #E60023; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.35);
}
.sm-crop-h::before { content: ''; position: absolute; inset: -12px; }   /* a bigger target for a finger */
/* owner, 2026-11-26 (CHANGES item 302, phone screenshot): the handles sat half OUTSIDE the box (-11px), so when the
   box covers the whole photo its corners are the viewport's rounded, overflow-hidden edges and ~3/4 of each handle
   was cut off. Now they sit INSIDE the box corners (as phone photo apps do); the finger target stays big (::before). */
.sm-crop-h[data-h="nw"] { left: 5px; top: 5px; cursor: nwse-resize; }
.sm-crop-h[data-h="ne"] { right: 5px; top: 5px; cursor: nesw-resize; }
.sm-crop-h[data-h="sw"] { left: 5px; bottom: 5px; cursor: nesw-resize; }
.sm-crop-h[data-h="se"] { right: 5px; bottom: 5px; cursor: nwse-resize; }
#wSmViewport.sm-tool-crop { cursor: default; }
.sm-crop-apply { background: #4CAF50; color: #fff; }
.sm-crop-apply:not(:disabled):hover { background: #43a047; }
.sm-crop-apply:not(:disabled):active { background: #388e3c; }
.sm-crop-ico { display: block; }
/* six tools: on a phone they do not fit, so the row SWIPES with a "more this way" arrow (js/scroll-hint.js,
   Collage Maker's solution — owner, item 282). Each tool keeps a fair size instead of being squeezed. */
#wFmStep1 .sm-tool { flex: 1 0 auto; min-width: 68px; padding: 8px 6px; }

#wFmTabs .sm-tab[hidden] { display: none; }   /* "Background" exists only for a frame made from a shape (item 284) */
#wFmTabs .sm-tab { flex: 1 0 auto; white-space: nowrap; padding-left: 10px; padding-right: 10px; }   /* 4 tabs: swipe on a phone, never squeezed */

/* ── Layers (item 287): stickers, texts and the drawing share ONE stacking order (their z-index, set by the
   shared js/layer-stack-engine.js) — so their holders (.fm-deco) have NO z-index, the frame box isolates the
   order from the rest of the page, the holes (no z-index) stay under all of them, and the canvas used to draw
   a hole by hand is always on top. ── */
.fm-wrap { isolation: isolate; }
.fm-spotdraw { z-index: 1000; }
#wFmLayersBtn[hidden] { display: none; }
#wFmLayersPanel { margin: 0 0 4px; }
#wFmLayersPanel .wls-base { display: none; }     /* no "Photo" row: everything sits on the frame */

/* ── Stickers + Text on a frame made from a shape (item 285): above the holes; order = Layers (item 287) ── */
.fm-deco { position: absolute; inset: 0; pointer-events: none; }
.fm-deco > .wst-el, .fm-deco > .wDragTextWrap { pointer-events: auto; }
.fm-wrap.fm-drawtab .fm-deco > *, .fm-wrap.fm-drawing .fm-deco > * { pointer-events: none; }   /* Draw tab / drawing a hole: the pen only */
#wFmTexts .wDragTextWrap.txt-selected { outline: 2px dashed #e60023; }
/* the panels: the same look as Collage Maker's Stickers / Text panels */
.fm-sticker-cats { display: flex; flex-wrap: nowrap; gap: 6px; padding-bottom: 4px; }
.fm-sticker-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; max-height: 210px; overflow-y: auto; overflow-x: hidden; padding: 4px 2px; margin-top: 8px; scrollbar-width: thin; box-sizing: border-box; width: 100%; }
@media (max-width: 480px) { .fm-sticker-grid { grid-template-columns: repeat(4, 1fr); gap: 5px; } }
.fm-text-top { display: flex; justify-content: center; gap: 8px; }
.fm-text-top .sm-btn[hidden], .fm-text-edit[hidden] { display: none; }
#wFmTextDone { background: #E60023; border-color: #E60023; color: #fff; padding: 0 22px; font-size: 14px; font-weight: 800; }
#wFmTextDone:hover { background: #c4001d; }
.fm-text-edit { margin-top: 10px; }
#wFmTextInput {
  display: block; width: 100%; box-sizing: border-box; min-height: 48px; resize: vertical; padding: 8px 10px;
  border: 2px solid #2c2c2c; border-radius: 8px; font: 700 16px 'Nunito', sans-serif; color: #2c2c2c; background: #fff;
}
#wFmTextInput:focus { outline: none; border-color: #E60023; }
.fm-text-style { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 14px; margin-top: 10px; }
.fm-text-ol { display: inline-flex; align-items: center; gap: 8px; }
#wFmTextFont { font: 700 13px 'Nunito', sans-serif; padding: 7px 8px; border: 2px solid #2c2c2c; border-radius: 8px; background: #fff; color: #2c2c2c; }
#wFmTextColor, #wFmTextOutlineColor { width: 34px; height: 30px; border: 2px solid #2c2c2c; border-radius: 6px; padding: 1px; background: #fff; cursor: pointer; }
.fm-text-extras { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; scrollbar-width: thin; }
.fm-text-grid { display: flex; flex-wrap: wrap; gap: 5px; max-height: 170px; overflow-y: auto; padding: 6px 2px; margin-top: 4px; scrollbar-width: thin; }
.fm-extra {
  background: #f9f9f9; border: 1.5px solid #ddd; padding: 5px 8px; font-size: 14px; cursor: pointer; border-radius: 6px;
  font-family: inherit; white-space: nowrap; touch-action: manipulation; color: #2c2c2c;
}
.fm-extra:hover { background: #fff8d6; border-color: #2c2c2c; }

/* ── step 1, first screen (item 283): a photo OR a shape to start from ── */
.fm-start-lead { margin: 0 0 14px; text-align: center; font: 700 14px/1.45 'Nunito', sans-serif; color: #555; }
#wSmUploadZone[hidden] { display: none; }
/* "Upload a photo": the first card, same size as the shapes, the site's red upload colours */
.fm-bases .sf-shape.fm-photo { background: #fff5f0; border-color: #E60023; border-style: dashed; color: #2c2c2c; }
.fm-bases .sf-shape.fm-photo:hover, .fm-bases .sf-shape.fm-photo.fm-over { background: #ffe9e0; }
.fm-photo-ico { font-size: 26px; line-height: 40px; color: #E60023; }
.fm-bases .sf-shape.fm-picked { background: #FFE566; box-shadow: 2px 2px 0 #2c2c2c; }
/* small phones: the card names are made to fit in the shared css/shape-frames.css (CHANGES items 297–298) */
.fm-pad-box { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 14px; }
.fm-pad-box[hidden], .fm-base-next[hidden], #wFmBackToPhoto[hidden] { display: none; }
.fm-pad-wrap {
  width: min(100%, 360px); aspect-ratio: 1; box-sizing: border-box; overflow: hidden;
  border: 3px solid #2c2c2c; border-radius: 12px; background-color: #fff;
  background-image: conic-gradient(#e9e6ee 25%, #fff 0 50%, #e9e6ee 0 75%, #fff 0); background-size: 20px 20px;
}
.fm-pad { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.fm-base-next { margin-top: 16px; }
#wSmChangeRow { flex-wrap: wrap; gap: 8px; }

/* "← Back to step 1" above "Step 2", in the top corner — Collage Maker's .cm-back-top (owner, item 282) */
#wFmStep2 .sm-back-link.fm-back-top { align-self: flex-start; margin: 0 0 12px; font-size: 13px; }
