/* Capture from anywhere (capture.js, voice.js): the mic in Home's box and the Ask Ditto bar, the veil for a photo
   dropped on Home, the offline pill, and the one-time "Ditto on your home screen" offer. Tokens from base.css and
   app.css: --sheet, --acc*, --ink*, --fs-*, --font-display. */

/* ------------------------------------------------------------ the mic */
.vc-mic {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink-3);
  background: transparent;
  cursor: pointer;
  transition: color var(--t-1, 0.16s), background var(--t-1, 0.16s), transform var(--t-2, 0.28s) var(--ease, ease-out);
}
.vc-mic .vc-ico {
  position: relative;
  z-index: 1;
  width: 21px;
  height: 21px;
}
.vc-mic:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
.vc-mic:active {
  transform: scale(0.94);
}
.vc-mic:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--acc-wash);
}
/* listening: the button in their colour, a soft ring breathing out from it */
.vc-mic.is-on {
  color: var(--acc-ink);
  background: color-mix(in srgb, var(--acc) 22%, var(--sheet));
  box-shadow: inset 0 0 0 1.5px var(--acc-line);
}
.vc-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}
.vc-mic.is-on .vc-ring {
  background: color-mix(in srgb, var(--acc) 34%, transparent);
  animation: vc-breathe 1.6s var(--ease, ease-out) infinite;
}
@keyframes vc-breathe {
  0% {
    opacity: 0.7;
    transform: scale(1);
  }
  100% {
    opacity: 0;
    transform: scale(1.7);
  }
}
:root[data-motion="reduced"] .vc-mic.is-on .vc-ring {
  animation: none;
  opacity: 0.4;
  transform: scale(1.18);
}
@media (prefers-reduced-motion: reduce) {
  .vc-mic.is-on .vc-ring {
    animation: none;
    opacity: 0.4;
    transform: scale(1.18);
  }
}

/* Home's box: the mic at the end of the first line */
.ha-field.has-mic {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 8px;
}
.ha-field.has-mic > .ha-photo {
  grid-column: 1 / -1;
}
.ha-mic {
  margin: -4px -6px 0 0;
  width: 42px;
  height: 42px;
}
.hm-ask.vc-listening {
  box-shadow: 0 0 0 1.5px var(--acc-line), 0 0 0 6px var(--acc-wash), 0 30px 70px -30px rgba(70, 40, 110, 0.5);
}

/* the Ask Ditto bar: beside the keycap at rest, before Send once there are words; away while it works */
.dr-mic {
  margin-right: -4px;
}
.dr-console:not(.is-focus):not(.has-text):not(.busy) .dr-mic {
  margin-right: 34px; /* (the "/" keycap sits over the resting Send) */
}
@media (hover: none), (pointer: coarse) {
  .dr-console:not(.is-focus):not(.has-text):not(.busy) .dr-mic {
    margin-right: -4px;
  }
}
.dr-console.busy .dr-mic {
  display: none;
}

/* ------------------------------------------------------------ a photo dropped on Home */
.cap-drop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 16px;
  background: color-mix(in srgb, var(--air, #f7f4f2) 42%, transparent);
  -webkit-backdrop-filter: blur(6px) saturate(1.1);
  backdrop-filter: blur(6px) saturate(1.1);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s var(--ease, ease-out);
}
.cap-drop.on {
  opacity: 1;
}
.cap-drop-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%, 520px);
  padding: 44px 28px;
  border-radius: 32px;
  background: var(--sheet);
  box-shadow: 0 0 0 1px var(--sheet-edge), 0 30px 70px -30px rgba(70, 40, 110, 0.55);
  outline: 2px dashed var(--acc-line);
  outline-offset: -14px;
  transform: scale(0.97);
  transition: transform 0.22s var(--ease, ease-out);
}
.cap-drop.on .cap-drop-card {
  transform: none;
}
.cap-drop-ico {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  color: var(--acc-ink);
  background: var(--acc-wash);
}
.cap-drop-ico svg {
  width: 30px;
  height: 30px;
}
.cap-drop-card b {
  font: 500 calc(24px * var(--ts, 1))/1.2 var(--font-display, system-ui);
  color: var(--ink);
}

/* ------------------------------------------------------------ offline */
.cap-net {
  position: fixed;
  left: 50%;
  top: calc(14px + env(safe-area-inset-top, 0px));
  z-index: 260;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px 0 13px;
  border-radius: 999px;
  font: 600 var(--fs-s, 13.5px)/1 var(--font-body, system-ui);
  color: var(--ink);
  background: var(--sheet, #fffdfa);
  box-shadow: 0 0 0 1px var(--sheet-edge, rgba(62, 44, 92, 0.1)), 0 12px 30px -14px rgba(60, 40, 90, 0.5);
  transform: translate(-50%, -8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease, ease-out), transform 0.24s var(--ease, ease-out);
}
.cap-net.on {
  opacity: 1;
  transform: translate(-50%, 0);
}
.cap-net-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
}
.cap-net.back .cap-net-dot {
  background: var(--sj-sage, #5f9473);
}
/* (under the app's bar, not over it) */
body.in-app .cap-net {
  top: calc(78px + env(safe-area-inset-top, 0px));
}

/* ------------------------------------------------------------ "Ditto on your home screen" */
.cap-offer {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 250;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(calc(100vw - 32px), 410px);
  padding: 12px 10px 12px 12px;
  border-radius: 24px;
  background: var(--sheet);
  box-shadow: 0 0 0 1px var(--sheet-edge), 0 24px 60px -24px rgba(70, 40, 110, 0.55);
  transform: translateY(12px);
  opacity: 0;
  transition: opacity 0.24s var(--ease, ease-out), transform 0.3s var(--ease, ease-out);
}
.cap-offer.on {
  opacity: 1;
  transform: none;
}
.cap-offer-icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 4px 12px -6px rgba(20, 20, 50, 0.5);
}
.cap-offer-t {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
}
.cap-offer-t b {
  font: 500 var(--fs-l, 17px)/1.2 var(--font-display, system-ui);
  color: var(--ink);
}
.cap-offer-t > span {
  font-size: var(--fs-s, 13.5px);
  color: var(--ink-3);
}
.cap-offer-t em {
  font-style: normal;
  font-weight: 600;
  color: var(--ink-2);
}
.cap-offer-share {
  display: inline-grid;
  vertical-align: -4px;
  color: var(--acc-ink);
}
.cap-offer-share svg {
  width: 18px;
  height: 18px;
}
.cap-offer-add {
  flex: none;
}
.cap-offer-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink-3);
  background: transparent;
  cursor: pointer;
}
.cap-offer-x:hover {
  color: var(--ink);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}
.cap-offer-x svg {
  width: 18px;
  height: 18px;
}
@media (max-width: 760px) {
  .cap-offer {
    left: 16px;
    right: 16px;
    width: auto;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  }
}
:root[data-motion="reduced"] :is(.cap-offer, .cap-net, .cap-drop, .cap-drop-card) {
  transition: none;
}
@media (max-width: 760px) {
  body.in-app .cap-net {
    top: calc(22px + env(safe-area-inset-top, 0px));
  }
}
