/* Box sizing rules */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Prevent font size inflation */
html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
}

/* Remove default margin in favour of better control in authored CSS */
body,
h1,
h2,
h3,
h4,
p,
figure,
blockquote,
dl,
dd {
  margin-block-end: 0;
}

/* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */
ul[role="list"],
ol[role="list"] {
  list-style: none;
}

/* Set core body defaults */
body {
  min-height: 100vh;
  line-height: 1.5;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
  text-transform: lowercase;
  background-color: #f0f0f0;
  line-height: 150%;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
}

/* Set shorter line heights on headings and interactive elements */
h1,
h2,
h3,
h4,
button,
input,
label {
  line-height: 1.1;
}

/* Balance text wrapping on headings */
h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

/* A elements that don't have a class get default styles */
a:not([class]) {
  text-decoration-skip-ink: auto;
  color: currentColor;
}

/* Make images easier to work with */
img,
picture {
  max-width: 100%;
  display: block;
}

/* Inherit fonts for inputs and buttons */
input,
button,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

/* Make sure textareas without a rows attribute are not tiny */
textarea:not([rows]) {
  min-height: 10em;
}

/* Anything that has been anchored to should have extra scroll margin */
:target {
  scroll-margin-block: 5ex;
}

/* Global Styles */

:root {
  --header-height: 76px;
  --nav-height: 50px;
}

.wrapper {
  max-width: 600px;
  margin: 0 auto;
  min-height: 100%;
  width: 100%;
  background-color: white;
}

[hidden] {
  display: none !important;
}

/* Override hidden for animated dialogs */
.dialog-wrapper[hidden] {
  display: flex !important;
  pointer-events: none;
}

/* Buttons */

.button {
  display: inline-block;
  padding: 0.5em 1em;
  background-color: black;
  color: white;
  outline: none;
  border: none;
  font-size: 1.5rem;
  text-decoration: none;
  text-transform: lowercase;
}
.button.secondary {
  background-color: white;
  border: solid 2px black;
  color: black;
}
.button:disabled {
  background-color: #ccc;
  color: #666;
  cursor: not-allowed;
}

.button.special {
  background-color: #efb435;
  color: black;
  font-weight: 600;
  box-shadow: rgb(239, 180, 53, 0.16) 0px 0px 8px 0;
}

.actions {
  display: flex;
  gap: 1em;
  margin: 2em 0;
  justify-content: space-between;
}

.actions * + * {
  flex: 1;
}

/* Error Messages */

.error {
  color: red;
  font-size: 0.9em;
  border-left: solid 2px red;
  padding: 0.5em 1em;
  font-weight: 600;
  background-color: rgba(255, 0, 0, 0.08);
  display: flex;
  gap: 1em;
  align-items: center;
  margin: 1em 0 1em;
}

.error:before {
  content: "";
  display: inline-block;
  width: 0.5em;
  height: 0.5em;
  background-color: red;
  border-radius: 50%;
}

/* Forms */

.form-section {
  padding: 2em;
  border-top: solid 1px #ccc;
}

.form-section label,
.form-section p.label {
  display: block;
  font-size: 1.5em;
  font-weight: 600;
  margin: 0;
}
.form-section p.note {
  font-size: 0.9em;
  margin: 0;
  color: #666;
}

.form-section input[type="tel"],
.form-section input[type="text"] {
  width: 100%;
  padding: 1em;
  font-size: 1.2em;
  margin: 1em 0;
  border: solid 2px black;
}

.form-section textarea {
  width: 100%;
  padding: 1em;
  font-size: 1.2em;
  margin: 1em 0;
  border: solid 2px black;
}

.input-group {
  display: flex;
  gap: 1em;
}

.input-group input {
  margin-bottom: 0 !important;
}

/* Welcome Screen */
#welcomeScreen .wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
}

#welcomeScreen .main-header {
  text-align: center;
  padding: 8em 2em 0;
  flex: 1;
}
#welcomeScreen .main-header h1 {
  font-size: 8em;
  margin: 0;
  padding: 0;
  font-weight: 800;
}

#welcomeScreen .main-header p {
  font-size: 1.5em;
  margin: 0;
  padding: 0;
}

#welcomeScreen .button {
  font-size: 1.5em;
  margin: 0 0 1em;
}

#welcomeScreen .main-footer {
  padding: 2em;
}

/* Sign In Screen */
#signInScreen .main-header {
  padding: 2em;
}

#signInScreen .main-header h1 {
  font-size: 3rem;
  margin: 0;
}

/* Initially hide validation code section */
#signInScreen #validationCode {
  display: none;
}

/* New Profile Screen */
#newProfileScreen .main-header {
  padding: 2em;
}

#newProfileScreen .main-header h1 {
  font-size: 3rem;
  margin: 0;
}
#newProfileScreen #selfiePreview {
  width: 100%;
  aspect-ratio: 1 / 1;
  background-image: url("../img/placeholder.png");
  margin: 1em 0;
  background-size: cover;
  background-position: center;
  border: solid 2px black;
  position: relative;
}

#newProfileScreen .selfie-upload-button input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* Confirmation Screen */
#confirmationScreen .main-header {
  padding: 2em;
}

#confirmationScreen .main-header h1 {
  font-size: 3rem;
  margin: 0;
}

#confirmationScreen .user-card {
  margin-top: 2em;
  box-shadow: 0 8px 24px 0 rgba(0, 0, 0, 0.24);
}

/* User Card */
.user-card {
  display: flex;
  flex-direction: column;
  padding: 1em;
  background-color: white;
  border: solid 2px black;
}

.user-card .actions {
  display: flex;
  gap: 0.5em;
  margin: 1em 0 0;
}
.user-card .actions .button {
  font-size: 1rem;
}

.user-card--header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1em;
  align-items: baseline;
}

.user-card--name {
  font-size: 1.5em;
  font-weight: bold;
  margin: 0;
}

.user-card--distance {
  font-size: 0.9em;
  color: #666;
  margin: 0;
}

.user-card--invite {
  font-size: 0.9em;
  border-left: solid 2px #efb435;
  color: black;
  margin: 1em 0 0;
  background-color: rgba(239, 180, 53, 0.08);
  padding: 0.5em 1em;
}

.user-card--age {
  font-size: 1.5em;
  margin: 0;
}

.user-card--selfie {
  width: 100%;
  height: auto;
}

.user-card--headline {
  font-size: 1em;
  font-style: italic;
  color: #333;
}

.user-card-inline {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: 1em 1em 0;
}

.user-card-inline + .user-card-inline {
  border-top: solid 1px #ccc;
}

.user-card-inline .avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
}
.user-card-inline .actions {
  margin: 0;
}
.user-card-inline .button {
  font-size: 1em;
}
.user-card-inline--codename {
  font-size: 1em;
  font-weight: bold;
  margin: 0;
}
.user-card-inline .info {
  flex: 1;
  line-height: 125%;
}
.user-card-inline--distance,
.user-card-inline--age {
  font-size: 0.8em;
  color: #666;
  margin: 0;
}

/* Loading Animation */

#loadingScreen .wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  gap: 1em;
}

.orbit-animation {
  font-size: 16px;
}

.orbit-animation .ring {
  border: solid 2px black;
  padding: 1.5em;
  border-radius: 50%;
  position: relative;
  animation: orbit 2s linear infinite;
}

.orbit-animation > .ring,
.orbit-animation > .ring > .ring > .ring {
  animation-direction: reverse;
  animation-duration: 3s;
}

.orbit-animation .ring:before,
.orbit-animation .ring:after {
  content: "";
  border: solid 2px black;
  height: 16px;
  width: 16px;
  background-color: white;
  border-radius: 50%;
  position: absolute;
}

.orbit-animation .ring:after {
  top: -8px;
  right: calc(50% - 8px);
}

.orbit-animation .ring:before {
  bottom: -8px;
  left: calc(50% - 8px);
}

.loading-message {
  font-size: 0.9em;
  color: #333;
  text-align: center;
  padding: 1em;
}

@keyframes orbit {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Main Screen */

#mainScreen {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#mainScreen .main-header {
  padding: 1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: solid 2px black;
  flex: 0 0 auto;
}

#mainScreen .wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  height: 100%;
}

#mainScreen .main-header,
#mainScreen .main-nav {
  flex: 0 0 auto;
}

#mainScreen .profile {
  display: flex;
  align-items: center;
  gap: 1em;
}
#mainScreen .profile--avatar {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 50%;
}
#mainScreen .profile--name {
  font-size: 1.5em;
  font-weight: bold;
  margin: 0;
}
#mainScreen .timer {
  font-size: 1.2em;
  color: #666;
  margin: 0;
}

#mainScreen .main-nav {
  display: flex;
  justify-content: space-between;
  border-bottom: solid 2px black;
  gap: 2px;
  background-color: black;
}

#mainScreen .main-nav button {
  flex: 1;
  padding: 0.5em 1em;
  font-size: 1em;
  background-color: white;
  color: black;
  border: none;
  text-transform: lowercase;
}

#mainScreen .main-nav button.active {
  background-color: black;
  color: white;
}

#mainScreen #content {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 1;
}

/* User list */
.user-list {
  list-style: none;
  padding: 2em;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1em;
}

/* Dialogs */
.dialog-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s ease-out;
  pointer-events: none;
  opacity: 0;
  z-index: 1000;
}

.dialog-wrapper.show {
  background-color: rgba(0, 0, 0, 0.64);
  pointer-events: auto;
  opacity: 1;
}

.dialog {
  background-color: white;
  max-width: 500px;
  width: 100%;
  margin: 1em;
  transform: translateY(-100px) scale(0.9);
  opacity: 0;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.4s ease-in-out;
  z-index: 1001;
  position: relative;
}

.dialog-wrapper.show .dialog {
  transform: translateY(0) scale(1);
  opacity: 1;
}

.dialog--header {
  padding: 1em;
  background-color: #f4f4f4;
  text-align: center;
}

.dialog--actions {
  padding: 0 2em 2em;
  display: flex;
  gap: 0.5em;
  flex-direction: row-reverse;
}

.dialog--actions .button {
  font-size: 1em;
}

.dialog #inviteMessage {
  margin-bottom: 0;
}

.dialog--actions > .button {
  flex: 1;
}

/* My Orbit */
#myOrbitSection .user-list {
  padding: 0;
}

#myOrbitSection {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Typography */
.section-header {
  font-weight: bold;
  margin: 0;
  padding: 1em;
}
/* Fills */
.grey {
  background-color: #f4f4f4;
  border-top: solid 1px #ccc;
  margin-top: 1em;
  flex: 1;
}

/* Chat Screen */
#chatScreen {
  display: flex;
  flex-direction: column;
}

#chatScreen .wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background-color: #f4f4f4;
}

#chatScreen .main-header {
  padding: 1em;
  background-color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: solid 2px black;
}

#chatScreen .main-header h1 {
  font-size: 0.9em;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75em;
}

#chatScreen .main-header h1 button.back {
  background: none;
  border: none;
  font-size: 1.2em;
}
#chatScreen .main-header h1 img.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: none;
}
#chatScreen #menuButton {
  font-size: 0.8em;
  font-weight: 600;
}

#chatScreen #chatArea {
  flex: 1;
  overflow-y: auto;
  padding: 1em;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

#chatScreen #chatForm {
  display: flex;
  padding: 1em;
  flex-direction: column;
  background-color: white;
  border-top: solid 2px black;
  margin: 0;
  gap: 0.5em;
}
#chatScreen #chatForm #messageInput {
  border: solid 2px black;
  resize: none;
  padding: 1em;
  font-size: 1em;
  overflow: hidden;
}

#chatScreen .bubble {
  padding: 0.5em 1em;
  background: black;
  color: white;
  font-weight: 400;
  margin: 0;
  max-width: 80%;
  align-self: flex-start;
}

#chatScreen .bubble.self {
  background-color: white;
  border: solid 2px black;
  color: black;
  font-weight: 600;
  align-self: flex-end;
}

.bottom-menu-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0);
  z-index: 1000;
  transition: background-color 0.3s ease-out;
  pointer-events: none;
  opacity: 0;
}

.bottom-menu-wrapper.show {
  background-color: rgba(0, 0, 0, 0.64);
  pointer-events: auto;
  opacity: 1;
}

.bottom-menu {
  position: absolute;
  bottom: 0;
  width: 100%;
  background-color: white;
  display: flex;
  flex-direction: column;
  padding: 10em 1em 1em;
  gap: 0.5em;
  background-image: url("../img/planets.png");
  background-size: contain;
  background-repeat: no-repeat;
  background-position: top center;
  transform: translateY(100%);
  transition: transform 0.3s ease-out;
}

.bottom-menu-wrapper.show .bottom-menu {
  transform: translateY(0);
}

.bottom-menu button {
  font-size: 1em;
}

/* Empty States */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  /* gap: 0.5em; */
  padding: 2em;
  text-align: center;
}
