/* =============================================================================================
   Rerun (features.rerun, Yowana 11/21): the full-screen camera that puts a run on the runner
   (Components/Rerun/RerunCamera; js/rerun.js draws the picture on the canvas). This is the screen
   around it: the top row, the typeface switch, the look chips, the shutter, Photo | Clip, and the shot with its options
   (the kit's primary button for "Post to Supwell", then share.css's .sw-ss-opts tiles).
   Plain CSS on the sw.css tokens (Tailwind does not compile this file, so app.min.css is untouched).
   Linked after share.css by Supwell/wwwroot/index.html (app) and Supwell.Web/Components/App.razor (web).
   The picture is 9:16 and shown whole (what you see is what's saved), so a tall phone has a dark
   band under it where the look chips sit. Motion is off under prefers-reduced-motion.
   ============================================================================================= */

.sw-rr-host { display: contents; }
.sw-rr {
  position: fixed; inset: 0; z-index: calc(var(--sw-z-sheet) - 1);
  display: flex; align-items: center; justify-content: center;
  background: #0f110b; color: var(--sw-cream);
  outline: none; overscroll-behavior: contain; touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  animation: sw-rr-in calc(220ms / var(--sw-tempo, 1)) ease-out both;
}
@keyframes sw-rr-in { from { opacity: 0; } to { opacity: 1; } }

.sw-rr__frame {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  width: 100%; height: 100%;
  padding-top: var(--sw-safe-t);
}
@media (min-width: 640px) and (min-height: 560px) {
  .sw-rr__frame { width: min(100%, calc((100dvh - 48px) * 9 / 16)); height: min(100%, calc(100dvh - 48px)); padding-top: 0; border-radius: 18px; }
}

/* ---- the picture ------------------------------------------------------------------------------ */
.sw-rr__stage { position: relative; flex: 1 1 auto; min-height: 0; }
/* A drag on the picture moves the look (js/rerun.js), so the browser leaves touches on it alone. */
.sw-rr__canvas { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center top; background: #0f110b; touch-action: none; cursor: grab; }

/* ---- the top row: close, name (or the clip's clock), switch camera ----------------------------- */
.sw-rr__top {
  position: absolute; z-index: 4; top: 0; left: 0; right: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: calc(var(--sw-safe-t) + 10px) calc(var(--sw-safe-r) + 12px) 0 calc(var(--sw-safe-l) + 12px);
  pointer-events: none;
}
@media (min-width: 640px) and (min-height: 560px) { .sw-rr__top { padding-top: 12px; } }
.sw-rr__round {
  pointer-events: auto; position: relative; flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; background: rgba(15, 17, 11, .5); color: var(--sw-cream); cursor: pointer;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); -webkit-tap-highlight-color: transparent;
}
.sw-rr__round:disabled, .sw-rr__round.is-off { opacity: .4; cursor: default; }
.sw-rr__round:focus-visible, .sw-rr__pick:focus-within { outline: 2px solid var(--sw-yellow); outline-offset: 2px; }
.sw-rr__round--none { background: none; -webkit-backdrop-filter: none; backdrop-filter: none; pointer-events: none; }
.sw-rr__round--mute { color: rgba(246, 243, 230, .6); }
.sw-rr__brand { font: 700 12px/16px var(--sw-font-mono); letter-spacing: .08em; text-transform: uppercase; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.sw-rr__rec { display: none; align-items: center; gap: 6px; }
.sw-rr__rec i { width: 8px; height: 8px; border-radius: 50%; background: #e5432d; animation: sw-rr-blink 1s steps(2) infinite; }
@keyframes sw-rr-blink { 50% { opacity: .25; } }
.sw-rr__frame[data-rerun-rec] .sw-rr__name { display: none; }
.sw-rr__frame[data-rerun-rec] .sw-rr__rec { display: inline-flex; }

/* ---- under the picture: the note, the looks, the shutter, Photo | Clip ------------------------- */
.sw-rr__bot {
  position: absolute; z-index: 3; left: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 28px calc(var(--sw-safe-r) + 16px) calc(var(--sw-safe-b) + 14px) calc(var(--sw-safe-l) + 16px);
  background: linear-gradient(rgba(15, 17, 11, 0), rgba(15, 17, 11, .72) 46%);
  /* Only the controls take touches: a drag that starts between them still moves the look. */
  pointer-events: none;
}
.sw-rr__bot > * { pointer-events: auto; }
.sw-rr__hint {
  margin: 0; padding: 4px 10px; border-radius: 999px; background: rgba(15, 17, 11, .5); pointer-events: none;
  font: 700 11px/16px var(--sw-font-mono); letter-spacing: .08em; text-transform: uppercase; color: rgba(246, 243, 230, .85);
}
.sw-rr__note {
  max-width: 320px; margin: 0; padding: 8px 12px; border-radius: 12px; background: rgba(15, 17, 11, .6);
  text-align: center; font: 500 13px/18px var(--sw-font-ui); color: var(--sw-cream); text-wrap: balance;
}
.sw-rr__looks { display: flex; gap: 8px; max-width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sw-rr__looks::-webkit-scrollbar { display: none; }
.sw-rr__look {
  flex: none; min-height: 36px; padding: 0 14px; border: 1px solid rgba(246, 243, 230, .55); border-radius: 999px;
  background: rgba(15, 17, 11, .45); color: var(--sw-cream); font: 600 13px/18px var(--sw-font-ui); cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.sw-rr__look[aria-pressed="true"] { background: var(--sw-yellow); border-color: var(--sw-yellow); color: #2d2d2d; }
.sw-rr__look:disabled { opacity: .5; cursor: default; }
.sw-rr__look:focus-visible { outline: 2px solid var(--sw-yellow); outline-offset: 2px; }

/* The Behind look's typeface (Yowana 11/22): one small switch over the looks, each named in its own
   face at the weight the picture draws it (Supwell Classic comes from app.min.css, the rest sw.css). */
.sw-rr__fonts { display: flex; gap: 2px; max-width: 100%; padding: 3px; border-radius: 999px; background: rgba(15, 17, 11, .55); }
.sw-rr__font {
  flex: none; min-height: 32px; padding: 0 13px; border: 0; border-radius: 999px; background: none; color: rgba(246, 243, 230, .85);
  font: 700 13px/18px var(--sw-font-head); cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, color .15s ease;
}
.sw-rr__font--supwell { font-family: "Supwell Classic", var(--sw-font-head); letter-spacing: .01em; }
.sw-rr__font--instrument { font: 400 17px/18px var(--sw-font-serif); font-synthesis: none; }
.sw-rr__font[aria-pressed="true"] { background: var(--sw-cream); color: #2d2d2d; }
.sw-rr__font:disabled { opacity: .5; cursor: default; }
.sw-rr__font:focus-visible { outline: 2px solid var(--sw-yellow); outline-offset: 2px; }

.sw-rr__shoot { display: flex; align-items: center; justify-content: center; gap: 32px; }
.sw-rr__pick { cursor: pointer; }
.sw-rr__file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.sw-rr__shutter {
  position: relative; flex: none; width: 72px; height: 72px; padding: 5px; border: 4px solid var(--sw-cream); border-radius: 50%;
  background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.sw-rr__shutter > span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--sw-cream); transition: border-radius .2s ease, transform .2s ease, background-color .2s ease; }
.sw-rr__shutter--clip > span { background: #e5432d; }
.sw-rr__shutter:active > span { transform: scale(.92); }
.sw-rr__shutter:disabled { opacity: .5; cursor: default; }
.sw-rr__shutter:focus-visible { outline: 2px solid var(--sw-yellow); outline-offset: 3px; }
/* Recording: the red turns into a stop square and the ring fills over the ten seconds. */
.sw-rr__frame[data-rerun-rec] .sw-rr__shutter { border-color: transparent; background: conic-gradient(#e5432d calc(var(--rr-progress, 0) * 360deg), rgba(246, 243, 230, .45) 0); }
.sw-rr__frame[data-rerun-rec] .sw-rr__shutter::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; background: #0f110b; }
.sw-rr__frame[data-rerun-rec] .sw-rr__shutter > span { position: relative; border-radius: 8px; transform: scale(.5); }

.sw-rr__modes { display: flex; gap: 20px; }
.sw-rr__mode {
  min-height: 32px; padding: 0 6px; border: 0; background: none; color: rgba(246, 243, 230, .7); cursor: pointer;
  font: 700 12px/16px var(--sw-font-mono); letter-spacing: .08em; text-transform: uppercase; -webkit-tap-highlight-color: transparent;
}
.sw-rr__mode[aria-pressed="true"] { color: var(--sw-yellow); }
.sw-rr__mode:disabled { opacity: .5; cursor: default; }
.sw-rr__mode:focus-visible { outline: 2px solid var(--sw-yellow); outline-offset: 2px; border-radius: 6px; }

/* ---- the shot: the photo or clip, then where it goes ------------------------------------------- */
.sw-rr__result {
  position: absolute; z-index: 2; inset: 0; display: flex; flex-direction: column; background: #0f110b;
  padding-top: var(--sw-safe-t); animation: sw-rr-in calc(180ms / var(--sw-tempo, 1)) ease-out both;
}
@media (min-width: 640px) and (min-height: 560px) { .sw-rr__result { padding-top: 0; } }
/* The shot is shown whole in the room above the sheet (a percentage max-height doesn't hold an image
   back inside a flex item, so it is placed, not flowed). */
.sw-rr__preview { position: relative; flex: 1 1 auto; min-height: 120px; }
.sw-rr__preview img, .sw-rr__preview video {
  position: absolute; left: 16px; top: 58px; width: calc(100% - 32px); height: calc(100% - 70px);
  object-fit: contain; object-position: center;
}
.sw-rr__sheet {
  flex: none; display: flex; flex-direction: column; gap: 14px;
  padding: 16px calc(var(--sw-safe-r) + 16px) calc(var(--sw-safe-b) + 16px) calc(var(--sw-safe-l) + 16px);
  border-radius: 22px 22px 0 0; background: var(--sw-cream); color: var(--sw-ink);
  -webkit-user-select: none; user-select: none;
}
.sw-rr__sheethead { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sw-rr__h { margin: 0; font: 600 20px/26px var(--sw-font-head); letter-spacing: -.02em; color: var(--sw-ink); }
.sw-rr__again {
  min-height: 36px; padding: 0 14px; border: 1px solid var(--sw-olive); border-radius: 999px; background: transparent; color: var(--sw-olive);
  font: 600 14px/20px var(--sw-font-ui); cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.sw-rr__again:disabled { opacity: .4; cursor: default; }
.sw-rr__again:focus-visible { outline: 2px solid var(--sw-olive); outline-offset: 2px; }
/* "Post to Supwell" sits over the tiles, full width (the kit's primary button). */
/* One row: five tiles for a photo, three for a clip. */
.sw-rr__opts { grid-template-columns: repeat(auto-fit, minmax(56px, 1fr)); gap: 12px 4px; }
.sw-rr__opts .sw-ss-opt__t { font-size: 11px; line-height: 15px; }
.sw-rr__opts .sw-ss-ico { width: 48px; height: 48px; }

@media (prefers-reduced-motion: reduce) {
  .sw-rr, .sw-rr__result, .sw-rr__rec i { animation: none; }
  .sw-rr__shutter > span, .sw-rr__look, .sw-rr__font { transition: none; }
  .sw-rr__shutter:active > span { transform: none; }
}
