/* ========================================
   RAGS — CARGO INTEGRATION STYLESHEET

   Purpose:
   Recreate the CSS environment that RAGS
   receives when running standalone, while
   keeping Cargo responsible for #app's
   outer size and position.

   This file changes styling only.
   ======================================== */


/* ----------------------------------------
   COMPONENT CSS BOUNDARY
   ---------------------------------------- */

#app,
#app * {
  box-sizing: border-box;
}

/*
  Establish the standalone document's
  normal typography inside the component.
*/

#app {
  color: #fff;

  font-family:
    "neue-haas-grotesk-text",
    sans-serif;

  font-size: 16px;
  font-weight: 500;
  font-style: normal;
  line-height: normal;
  letter-spacing: normal;
}

/*
  Prevent Cargo typography rules applied
  directly to descendants from leaking
  through the component boundary.

  Component-specific rules below can still
  override these values normally.
*/

#app * {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: inherit;
  line-height: inherit;
  letter-spacing: inherit;
}


/* ----------------------------------------
   COMPONENT
   ---------------------------------------- */

#app #experience {
  width: 100%;
  height: 100%;
  position: relative;
}


/* ----------------------------------------
   CAMERA
   ---------------------------------------- */

#app #camera-container {
  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;
}

#app #camera-visual {
  position: relative;
  width: min(90%, 640px);
}

#app #camera-preview {
  width: 100%;
  height: auto;
  display: block;

  transform: scaleX(-1);
}


/* ----------------------------------------
   END STATE
   ---------------------------------------- */

#app #end-state-layout {
  position: absolute;

  top: 50%;
  left: 50%;

  width: min(90%, 640px);

  transform: translate(-50%, -50%);

  z-index: 15;
}

#app #end-state-still {
  width: 100%;
  height: auto;
  display: block;
}

#app #end-state-controls {
  position: absolute;

  top: 100%;
  left: 0;

  width: 100%;

  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-top: 32px;

  padding-left: 6%;
  padding-right: 6%;
}

@media (min-width: 768px) {
  #app #end-state-controls {
    padding-left: 6%;
    padding-right: 6%;
    margin-top: 24px;
  }
}

@media (max-width: 767px) {
  #app #end-state-controls {
    margin-top: 16px;
  }
}


/* ----------------------------------------
   END-STATE BUTTONS
   ---------------------------------------- */

#app #restart-button,
#app #listen-button,
#app #share-button {
  position: static;

  transform: none;

  margin: 0;

  cursor: pointer;

  color: #000;
  background: #efefef;

  border: none;
  border-radius: 8px;

  box-shadow: none;

  width: auto;
  min-width: 65px;
  white-space: nowrap;
  min-height: 44px;

  font: inherit;

  padding: 2px 8px;
}


/* ----------------------------------------
   CAMERA / ACTIVATION BUTTONS
   ---------------------------------------- */

#app #camera-button,
#app #activate-button {
  color: #000;
  background: #efefef;

  border: none;
  border-radius: 8px;

  box-shadow: none;
}


/* ----------------------------------------
   CAMERA STATUS
   ---------------------------------------- */

#app #camera-status {
  position: absolute;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  z-index: 20;

  width: max-content;
  max-width: 90%;

  text-align: left;
}

#app #camera-button,
#app #activate-button {
  position: absolute;

  top: calc(50% + 90px);
  left: 50%;

  transform: translateX(-50%);

  z-index: 30;

  padding: 12px 18px;

  cursor: pointer;
}


/* ----------------------------------------
   STATUS / LOADING
   ---------------------------------------- */

#app #status-message {
  position: absolute;

  top: calc(100% + 16px);
  left: 50%;

  transform: translateX(-50%);

  z-index: 20;

  text-align: center;

  white-space: nowrap;
}


/* ----------------------------------------
   INSTRUCTIONS
   ---------------------------------------- */

#app #instruction-message {
  position: absolute;

  top: 20%;
  left: 50%;

  transform: translateX(-50%);

  z-index: 20;

  text-align: center;

  white-space: nowrap;

  font-size: 28px;
}


/* ----------------------------------------
   COUNTDOWN
   ---------------------------------------- */

#app #countdown {
  position: absolute;

  top: 30%;
  left: 50%;

  transform: translateX(-50%);

  z-index: 20;

  font-size: 48px;

  text-align: center;
}


/* ----------------------------------------
   BUTTON TYPOGRAPHY

   This reproduces the existing standalone
   #app button rule.
   ---------------------------------------- */

#app button {
  font: inherit;
}

/* ----------------------------------------
   PLAYBACK FINISH CONTROL
   ---------------------------------------- */

#app #finish-button {
  position: absolute;

  top: calc(100% + 16px);
  right: 6%;

  transform: none;
  z-index: 30;

  width: max-content;
  min-width: max-content;
  max-width: calc(100% - 12%);
  min-height: 44px;

  margin: 0;
  padding: 0 4px;

  cursor: pointer;

  color: #fff;
  background: transparent;

  border: none;
  border-radius: 0;
  box-shadow: none;

  font-family: inherit;
  font-size: 18px;
  font-weight: inherit;
  font-style: inherit;
  line-height: normal;
  letter-spacing: normal;

  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;

  white-space: nowrap;

  appearance: none;
  -webkit-appearance: none;
}

@media (min-width: 768px) {
  #app #finish-button {
    top: calc(100% + 24px);
  }
}

/* ----------------------------------------
   PLAYBACK PROMPT
   ---------------------------------------- */

#app #playback-prompt {
  position: absolute;

  bottom: 12%;
  left: 0;

  width: 100%;

  margin-bottom: 0;

  text-align: center;

  font-family:
    "neue-haas-grotesk-text",
    sans-serif;

  font-weight: 500;

  font-size: 20px;

  line-height: 1.2;

  opacity: 0.55;

  will-change: opacity;
}

/* End-state button sizing in Cargo */
#app #restart-button,
#app #listen-button,
#app #share-button {
  width: auto;
  min-width: 65px;
  white-space: nowrap;
  font: inherit;
}
  font-style: normal;
  line-height: normal;
  letter-spacing: normal;
}

/*
  Prevent Cargo typography rules applied
  directly to descendants from leaking
  through the component boundary.

  Component-specific rules below can still
  override these values normally.
*/

#app * {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  font-style: inherit;
  line-height: inherit;
  letter-spacing: inherit;
}


/* ----------------------------------------
   COMPONENT
   ---------------------------------------- */

#app #experience {
  width: 100%;
  height: 100%;
  position: relative;
}


/* ----------------------------------------
   CAMERA
   ---------------------------------------- */

#app #camera-container {
  width: 100%;
  height: 100%;

  display: flex;
  align-items: center;
  justify-content: center;
}

#app #camera-visual {
  position: relative;
  width: min(90%, 640px);
}

#app #camera-preview {
  width: 100%;
  height: auto;
  display: block;

  transform: scaleX(-1);
}


/* ----------------------------------------
   END STATE
   ---------------------------------------- */

#app #end-state-layout {
  position: absolute;

  top: 50%;
  left: 50%;

  width: min(90%, 640px);

  transform: translate(-50%, -50%);

  z-index: 15;
}

#app #end-state-still {
  width: 100%;
  height: auto;
  display: block;
}

#app #end-state-controls {
  position: absolute;

  top: 100%;
  left: 0;

  width: 100%;

  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-top: 32px;

  padding-left: 6%;
  padding-right: 6%;
}

@media (min-width: 768px) {
  #app #end-state-controls {
    padding-left: 6%;
    padding-right: 6%;
    margin-top: 24px;
  }
}

@media (max-width: 767px) {
  #app #end-state-controls {
    margin-top: 16px;
  }
}


/* ----------------------------------------
   END-STATE BUTTONS
   ---------------------------------------- */

#app #restart-button,
#app #listen-button,
#app #share-button {
  position: static;

  transform: none;

  margin: 0;

  cursor: pointer;

  color: #000;
  background: #efefef;

  border: none;
  border-radius: 8px;

  box-shadow: none;

  width: auto;
  min-width: 65px;
  white-space: nowrap;
  min-height: 44px;

  font: inherit;

  padding: 2px 8px;
}


/* ----------------------------------------
   CAMERA / ACTIVATION BUTTONS
   ---------------------------------------- */

#app #camera-button,
#app #activate-button {
  color: #000;
  background: #efefef;

  border: none;
  border-radius: 8px;

  box-shadow: none;
}


/* ----------------------------------------
   CAMERA STATUS
   ---------------------------------------- */

#app #camera-status {
  position: absolute;

  top: 50%;
  left: 50%;

  transform: translate(-50%, -50%);

  z-index: 20;

 width: min(90%, 500px);

 text-align: center;
}

#app #camera-button,
#app #activate-button {
  position: absolute;

  top: calc(50% + 90px);
  left: 50%;

  transform: translateX(-50%);

  z-index: 30;

  padding: 12px 18px;

  cursor: pointer;
}


/* ----------------------------------------
   STATUS / LOADING
   ---------------------------------------- */

#app #status-message {
  position: absolute;

  top: calc(100% + 16px);
  left: 50%;

  transform: translateX(-50%);

  z-index: 20;

  text-align: center;

  white-space: nowrap;
}


/* ----------------------------------------
   INSTRUCTIONS
   ---------------------------------------- */

#app #instruction-message {
  position: absolute;

  top: 20%;
  left: 50%;

  transform: translateX(-50%);

  z-index: 20;

  text-align: center;

  white-space: nowrap;

  font-size: 28px;
}


/* ----------------------------------------
   COUNTDOWN
   ---------------------------------------- */

#app #countdown {
  position: absolute;

  top: 30%;
  left: 50%;

  transform: translateX(-50%);

  z-index: 20;

  font-size: 48px;

  text-align: center;
}


/* ----------------------------------------
   BUTTON TYPOGRAPHY

   This reproduces the existing standalone
   #app button rule.
   ---------------------------------------- */

#app button {
  font: inherit;
}


/* ----------------------------------------
   PLAYBACK PROMPT
   ---------------------------------------- */

#app #playback-prompt {
  position: absolute;

  bottom: 12%;
  left: 0;

  width: 100%;

  margin-bottom: 0;

  text-align: center;

  font-family:
    "neue-haas-grotesk-text",
    sans-serif;

  font-weight: 500;

  font-size: 20px;

  line-height: 1.2;

  opacity: 0.55;

  will-change: opacity;
}

/* End-state button sizing in Cargo */
#app #restart-button,
#app #listen-button,
#app #share-button {
  width: auto;
  min-width: 65px;
  white-space: nowrap;
  font: inherit;
}
