/* The crop step before a profile photo is uploaded (assets/js/app-crop.js). A phone shows it full screen, a wider
   screen as a centred dialog, a phone held sideways with the controls beside the photo. The frame has the Discover
   card's shape and corners; outside it the photo is dimmed. Colours from the app.css tokens only. */
html.app-crop-lock,html.app-crop-lock body {overflow:hidden !important;}
.app-crop {position:fixed;inset:0;z-index:1300;display:flex;align-items:center;justify-content:center;box-sizing:border-box;background:#05080cd9;color:var(--app-text);font:400 15px/1.45 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;opacity:0;transition:opacity .2s var(--app-ease);-webkit-tap-highlight-color:transparent;}
.app-crop *,.app-crop *::before,.app-crop *::after {box-sizing:border-box;}
.app-crop.is-open {opacity:1;}
.app-crop:not(.is-open) {pointer-events:none;}
.app-crop-panel {display:flex;flex-direction:column;width:min(520px,calc(100vw - 48px));height:min(860px,calc(100vh - 48px));height:min(860px,calc(100dvh - 48px));padding:18px 20px 20px;border:1px solid var(--app-line);border-radius:22px;background:var(--app-deep);box-shadow:0 24px 60px #0009;transform:scale(.97);transition:transform .22s var(--app-ease);}
.app-crop.is-open .app-crop-panel {transform:none;}
.app-crop .app-crop-title {flex:none;margin:2px 0 14px;color:var(--app-text);font:800 20px/1.2 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;letter-spacing:-.01em;text-align:center;}

/* The photo under the frame */
.app-crop-stage {position:relative;flex:1 1 auto;min-height:180px;overflow:hidden;border-radius:16px;background:#05080c;outline:none;cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;}
.app-crop .app-crop-stage:focus,.app-crop .app-crop-stage:focus-visible {outline:none;box-shadow:none;}
.app-crop .app-crop-stage:focus-visible .app-crop-frame {box-shadow:0 0 0 3px var(--app-teal),0 0 0 200vmax #05080cb8;}
.app-crop-stage.is-moving {cursor:grabbing;}
.app-crop .app-crop-image {position:absolute;left:0;top:0;max-width:none;transform-origin:0 0;will-change:transform;pointer-events:none;}
.app-crop-frame {position:absolute;border-radius:22px;box-shadow:0 0 0 2px #ffffffd9,0 0 0 200vmax #05080cb8;pointer-events:none;}
/* Thirds, while the photo moves */
.app-crop-frame::before,.app-crop-frame::after {content:"";position:absolute;inset:0;border-radius:inherit;opacity:0;transition:opacity .18s var(--app-ease);}
.app-crop-frame::before {background:linear-gradient(90deg,transparent calc(33.33% - .5px),#ffffff73 calc(33.33% - .5px),#ffffff73 calc(33.33% + .5px),transparent calc(33.33% + .5px),transparent calc(66.67% - .5px),#ffffff73 calc(66.67% - .5px),#ffffff73 calc(66.67% + .5px),transparent calc(66.67% + .5px));}
.app-crop-frame::after {background:linear-gradient(180deg,transparent calc(33.33% - .5px),#ffffff73 calc(33.33% - .5px),#ffffff73 calc(33.33% + .5px),transparent calc(33.33% + .5px),transparent calc(66.67% - .5px),#ffffff73 calc(66.67% - .5px),#ffffff73 calc(66.67% + .5px),transparent calc(66.67% + .5px));}
.app-crop-stage.is-moving .app-crop-frame::before,.app-crop-stage.is-moving .app-crop-frame::after {opacity:1;}
/* Until the photo is decoded */
.app-crop-stage.is-loading::after {content:"";position:absolute;left:50%;top:50%;width:34px;height:34px;margin:-17px 0 0 -17px;border:3px solid var(--app-line);border-top-color:var(--app-teal);border-radius:50%;animation:app-crop-spin .8s linear infinite;}
@keyframes app-crop-spin {to {transform:rotate(1turn);}}

/* Help, zoom, buttons */
.app-crop-side {flex:none;}
.app-crop .app-crop-help {margin:14px 6px 0;color:var(--app-mut);font-size:14px;line-height:1.4;text-align:center;text-wrap:balance;}
.app-crop .app-crop-keys {display:none;margin:2px 6px 0;color:var(--app-mut);font-size:13px;line-height:1.4;text-align:center;}
@media(hover:hover) and (pointer:fine) {.app-crop .app-crop-keys {display:block;}}
.app-crop-zoom {display:flex;align-items:center;gap:10px;margin:10px 4px 0;color:var(--app-mut);}
.app-crop-zoom svg {flex:none;width:22px;height:22px;}
.app-crop input[type=range].app-crop-range {--fill:0%;flex:1 1 auto;min-width:0;height:44px;margin:0;padding:0;border:0;background:transparent;outline:none;cursor:pointer;-webkit-appearance:none;appearance:none;}
.app-crop input[type=range].app-crop-range:disabled {opacity:.45;cursor:default;}
.app-crop input[type=range].app-crop-range::-webkit-slider-runnable-track {height:4px;border:0;border-radius:2px;background:linear-gradient(90deg,var(--app-teal) var(--fill),var(--app-line) var(--fill));}
.app-crop input[type=range].app-crop-range::-moz-range-track {height:4px;border:0;border-radius:2px;background:linear-gradient(90deg,var(--app-teal) var(--fill),var(--app-line) var(--fill));}
.app-crop input[type=range].app-crop-range::-webkit-slider-thumb {width:24px;height:24px;margin:-10px 0 0;border:0;border-radius:50%;background:#fff;box-shadow:0 2px 8px #0008;-webkit-appearance:none;appearance:none;transform:none;transition:none;}
.app-crop input[type=range].app-crop-range::-moz-range-thumb {width:24px;height:24px;border:0;border-radius:50%;background:#fff;box-shadow:0 2px 8px #0008;}
.app-crop input[type=range].app-crop-range:focus-visible::-webkit-slider-thumb {box-shadow:0 0 0 4px var(--app-teal-soft),0 2px 8px #0008;}
.app-crop input[type=range].app-crop-range:focus-visible::-moz-range-thumb {box-shadow:0 0 0 4px var(--app-teal-soft),0 2px 8px #0008;}
.app-crop-actions {display:flex;gap:12px;margin-top:14px;}
.app-crop-actions .app-btn {flex:1 1 0;min-width:0;}
.app-crop-actions .app-btn:focus-visible {outline:2px solid var(--app-teal);outline-offset:2px;}
.app-crop[aria-busy="true"] .app-crop-actions .app-btn {opacity:.7;}

/* A phone: the whole screen, the photo from edge to edge */
@media(max-width:675px) {
 .app-crop {align-items:stretch;background:var(--app-night);}
 .app-crop-panel {width:100%;height:100%;padding:calc(var(--app-safe-top) + 12px) 16px calc(var(--app-safe-bottom) + 14px);border:0;border-radius:0;background:var(--app-night);box-shadow:none;transform:none;}
 .app-crop-stage {margin:0 -16px;border-radius:0;}
}
/* A phone held sideways: the photo on the left, everything else beside it */
@media(max-height:520px) and (orientation:landscape) {
 .app-crop {align-items:stretch;background:var(--app-night);}
 .app-crop-panel {display:grid;grid-template-columns:minmax(0,1fr) minmax(220px,300px);grid-template-rows:auto minmax(0,1fr);column-gap:18px;width:100%;height:100%;padding:calc(var(--app-safe-top) + 10px) calc(env(safe-area-inset-right,0px) + 16px) calc(var(--app-safe-bottom) + 10px) calc(env(safe-area-inset-left,0px) + 16px);border:0;border-radius:0;background:var(--app-night);box-shadow:none;transform:none;}
 .app-crop .app-crop-title {grid-column:2;grid-row:1;margin:4px 0 0;text-align:left;}
 .app-crop-stage {grid-column:1;grid-row:1 / 3;margin:0;border-radius:16px;}
 .app-crop-side {grid-column:2;grid-row:2;align-self:end;}
 .app-crop .app-crop-help {text-align:left;}
 .app-crop-actions {flex-direction:column-reverse;}
}
@media(prefers-reduced-motion:reduce) {
 .app-crop,.app-crop-panel,.app-crop-frame::before,.app-crop-frame::after {transition:none !important;}
 .app-crop-stage.is-loading::after {animation:none;}
}
