/* Styles of the chat page and the join page. Every text has a contrast of at least 4.5 to 1. */

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: #ffffff;
  color: #1a1a1a;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 4px 16px;
  position: sticky;
  top: 0;
  z-index: 1;
  margin: -16px -16px 16px;
  padding: 12px 16px;
  background: #1f4e79;
  color: #ffffff;
  /* The colour reaches both window edges, while the content stays in the 1100px column. */
  box-shadow: 0 0 0 100vmax #1f4e79;
  clip-path: inset(0 -100vmax);
}

.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 16px;
}

.brand img {
  display: block;
  max-width: 100%;
  height: auto;
}

h1 {
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.2;
}

#subtitle {
  margin: 0;
  font-size: 0.875rem;
}

#name {
  margin: 0;
  padding: 2px 12px;
  border-radius: 999px;
  background: #e8eff6;
  color: #1f4e79;
  font-size: 0.875rem;
  font-weight: bold;
}

.item {
  max-width: 85%;
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
}

.item p {
  margin: 0;
}

.label {
  font-weight: bold;
}

/* The time stays next to the label, lighter and smaller. */
.label .time {
  margin-left: 8px;
  font-size: 0.8125rem;
  font-weight: normal;
  color: #595959;
}

.note .label .time {
  color: inherit;
}

.text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.question {
  margin-left: auto;
  background: #dbe8f5;
}

.answer {
  margin-right: auto;
  background: #f2f2f2;
}

.note {
  margin-left: auto;
  margin-right: auto;
  max-width: 60%;
  padding: 4px 12px;
  text-align: center;
  font-size: 0.875rem;
  background: #f5f5f5;
  color: #4d4d4d;
}

#status {
  min-height: 1.5em;
  margin: 8px 0;
}

#ask {
  position: sticky;
  bottom: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 4px 12px;
  padding: 12px 0 16px;
  background: #ffffff;
  border-top: 1px solid #d0d0d0;
}

/* The label stays for screen readers, but is not drawn. */
#ask label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

textarea {
  grid-column: 1 / -1;
  display: block;
  width: 100%;
  box-sizing: border-box;
  min-height: 3.5rem;
  max-height: 10rem;
  field-sizing: content;
  padding: 12px 16px;
  border: 1px solid #8c8c8c;
  border-radius: 12px;
  background: #ffffff;
  color: #1a1a1a;
  font: inherit;
  resize: none;
}

textarea:focus-visible {
  outline: 2px solid #1f4e79;
  outline-offset: 1px;
}

#counter,
#hint {
  grid-column: 1;
  margin: 0;
  font-size: 0.875rem;
  color: #595959;
}

.buttons {
  grid-column: 2;
  grid-row: 2 / span 2;
  display: flex;
  gap: 8px;
}

button {
  padding: 8px 20px;
  border: 1px solid #1f4e79;
  border-radius: 999px;
  background: #1f4e79;
  color: #ffffff;
  font: inherit;
  cursor: pointer;
}

button:hover:not(:disabled) {
  background: #173a5c;
}

button:focus-visible {
  outline: 2px solid #1f4e79;
  outline-offset: 2px;
}

#reset {
  order: -1;
  background: #ffffff;
  color: #1f4e79;
}

#reset:hover:not(:disabled) {
  background: #e8eff6;
}

button:disabled,
#reset:disabled {
  border-color: #8c8c8c;
  background: #e0e0e0;
  color: #4d4d4d;
  cursor: default;
}

@media (max-width: 599px) {
  .item,
  .note {
    max-width: 100%;
  }

  .buttons {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  button {
    flex: 1;
  }
}
