/* Окно кадрирования фото (js/foto.js) и кнопки фото в отклике. Подключается макетом на формах запроса и отклика.
   Телефон - основная ширина: на узком экране окно во весь экран, цели нажатия от 44 px. */
html.fk-open,html.fk-open body{overflow:hidden}
.fk{position:fixed;inset:0;z-index:1000;background:rgba(34,34,34,.72);display:flex;align-items:center;justify-content:center;padding:16px}
.fk-box{background:#fff;color:#222;border-radius:14px;width:min(600px,100%);max-height:100%;overflow:auto;padding:16px;
        display:flex;flex-direction:column;gap:12px;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial,sans-serif}
.fk-box > *{flex-shrink:0}  /* иначе колонка ужимает снимок, а холст остаётся прежним - низ уходит под кнопки */
.fk-t{font-size:18px;font-weight:600;line-height:1.3;margin:0}
.fk-hint{font-size:15px;line-height:1.45;margin:0;background:#FFF4D6;border-radius:10px;padding:10px 12px;text-wrap:pretty}
.fk-stage{position:relative;align-self:center;overflow:hidden;background:#222;touch-action:none;user-select:none;-webkit-user-select:none;max-width:100%}
.fk-img{display:block}
.fk-frame{position:absolute;box-shadow:0 0 0 9999px rgba(0,0,0,.55);outline:2px solid #fff;cursor:move;touch-action:none}
.fk-frame:focus-visible{outline:3px solid #D53237}
/* Углы - внутри рамки: край снимка обрезает всё, что снаружи, а цель нажатия должна остаться целой (44 px) */
.fk-h{position:absolute;width:44px;height:44px}
.fk-h::after{content:'';position:absolute;width:22px;height:22px;border:0 solid #fff;filter:drop-shadow(0 0 1px rgba(0,0,0,.8))}
.fk-nw{left:0;top:0;cursor:nwse-resize}
.fk-nw::after{left:0;top:0;border-width:5px 0 0 5px}
.fk-ne{right:0;top:0;cursor:nesw-resize}
.fk-ne::after{right:0;top:0;border-width:5px 5px 0 0}
.fk-sw{left:0;bottom:0;cursor:nesw-resize}
.fk-sw::after{left:0;bottom:0;border-width:0 0 5px 5px}
.fk-se{right:0;bottom:0;cursor:nwse-resize}
.fk-se::after{right:0;bottom:0;border-width:0 5px 5px 0}
.fk-bar,.fk-act{display:flex;gap:8px;flex-wrap:wrap}
.fk-act{justify-content:flex-end}
.fk-box button{min-height:44px;padding:8px 16px;border-radius:10px;font:inherit;font-size:16px;cursor:pointer;
               border:1px solid #CFCFCF;background:#fff;color:#222}
.fk-box .fk-ok{background:#D53237;border-color:#D53237;color:#fff;font-weight:600}
.fk-box .fk-ok:hover{background:#B92A2E}
.fk-box button:focus-visible{outline:2px solid #222;outline-offset:2px}
@media(max-width:540px){
  .fk{padding:0}
  .fk-box{border-radius:0;width:100%;height:100%;max-height:none;padding:12px}
  .fk-bar button,.fk-act button{flex:1 1 auto}
}

/* Отклик: кнопки «Сфотографировать / Из галереи» и миниатюры. Без скрипта остаётся обычное поле файла */
.fk-btns{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin:8px 0 0}
.fk-btns[hidden],.ph-plain[hidden]{display:none}
@media(max-width:360px){ .fk-btns,.photo-btns{grid-template-columns:1fr} }  /* «Сфотографировать» не влезает в половину 320 px */
.fk-btns input{position:absolute;opacity:0;width:1px;height:1px}
.fk-btns label{display:flex;align-items:center;justify-content:center;min-height:48px;padding:10px 12px;border-radius:12px;
               font-size:16px;font-weight:500;text-align:center;cursor:pointer}
.fk-btns .fk-cam{background:#222;color:#fff}
.fk-btns .fk-gal{background:#fff;border:1px solid #CFCFCF}
.fk-btns input:focus-visible + label{outline:2px solid #222;outline-offset:2px}
.fk-thumbs{display:flex;gap:8px;flex-wrap:wrap;margin:12px 0 0}
.fk-thumbs:empty{display:none}
.fk-thumb{position:relative;width:96px;height:96px;border-radius:10px;overflow:hidden;background:#F5F5F5}
.fk-thumb img{width:100%;height:100%;object-fit:cover}
.fk-thumb button{position:absolute;top:4px;right:4px;width:32px;height:32px;border-radius:50%;border:0;background:rgba(34,34,34,.75);
                 color:#fff;font-size:18px;line-height:1;cursor:pointer}

/* «Сфотографировать» нужна там, где есть камера: на компьютере она открыла бы тот же выбор файла */
@media(hover:hover) and (pointer:fine){
  .fk-btns{grid-template-columns:1fr}
  .fk-btns .fk-cam,.fk-btns input[capture]{display:none}
  .photo-btns{grid-template-columns:1fr}
  .photo-btns .ph-cam,.photo-btns input[capture]{display:none}
}
