/* Styles of the Okalo Labs avatar's page (v033): Okalo's own colours (ink, coral) and type (Sora for titles, Work
   Sans for text). One bold element, the coral ring that stands for the avatar on the stage; everything around it
   stays quiet: the access-code form, the steps, the conversation, and the technical details folded away. */

@font-face {
  font-family: "Sora";
  src: url("/fonts/sora-latin-wght.woff2") format("woff2");
  font-weight: 100 800;
  font-display: swap;
}

@font-face {
  font-family: "Work Sans";
  src: url("/fonts/work-sans-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --ink: #111418;
  --tile: #1b2027;
  --rule: #343a42;
  --paper: #f4f5f7;
  --mist: #9aa3ae;
  --coral: #ff5a36;
  --display: "Sora", system-ui, sans-serif;
  --text: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

/* Hidden means hidden, even for elements whose own style sets how they are laid out. */
[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font: 400 17px/1.55 var(--text);
  -webkit-font-smoothing: antialiased;
}

/* Until the page knows whether this browser may use the call, it shows only the header. */
body.is-checking .foot {
  visibility: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 3px;
}

/* The header: Okalo's logo with "Labs", and on the right what this page is. */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 22px 24px;
}

.brand {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  color: var(--paper);
  text-decoration: none;
}

.brand__logo {
  display: block;
  height: 20px;
  width: auto;
}

.brand__labs {
  font: 400 19px/1 var(--display);
  letter-spacing: 0.01em;
  /* Sits on the wordmark's baseline. */
  transform: translateY(1px);
}

.top__side {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--mist);
  font-size: 14px;
}

.top__env {
  padding: 2px 8px;
  border: 1px solid var(--rule);
  border-radius: 6px;
}

.top__signout {
  padding: 0;
  border: 0;
  background: none;
  color: var(--mist);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.top__signout:hover {
  color: var(--paper);
}

/* Buttons: coral with ink text for the main action (white on coral is too faint for text), a quiet outline for the
   rest. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 26px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 600;
  font-size: 16px;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}

.button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.button--primary {
  background: var(--coral);
  color: var(--ink);
}

.button--primary:hover:not(:disabled) {
  background: #ff6e4e;
}

.button--quiet {
  background: transparent;
  border-color: var(--rule);
  color: var(--paper);
}

.button--quiet:hover {
  border-color: var(--mist);
}

/* The access-code form (guest address only). */
.entry {
  width: 100%;
  max-width: 440px;
  margin: 0 auto;
  padding: 12vh 24px 48px;
}

.entry__title {
  margin: 0 0 12px;
  text-wrap: balance;
  font: 300 40px/1.1 var(--display);
  letter-spacing: -0.015em;
}

.entry__lede {
  margin: 0 0 36px;
  color: var(--mist);
}

.entry__form {
  display: grid;
  gap: 10px;
}

.entry__label {
  font-size: 14px;
  font-weight: 500;
}

.entry__input {
  height: 56px;
  padding: 0 16px;
  border: 1px solid var(--rule);
  border-radius: 10px;
  background: var(--tile);
  font-size: 20px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.entry__input:focus {
  border-color: var(--coral);
  outline: none;
}

.entry__form .button {
  margin-top: 8px;
}

.entry__error {
  min-height: 1.55em;
  margin: 4px 0 0;
  color: #ff8a70;
  font-size: 15px;
}

.entry__fine {
  margin: 28px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--rule);
  color: var(--mist);
  font-size: 14px;
}

/* The call: the stage on the left, the words on the right (stacked on a phone). */
.call {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 48px;
  align-items: start;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 24px 40px;
}

.stage {
  position: relative;
  aspect-ratio: 1 / 1;
  max-height: calc(100vh - 140px);
  width: 100%;
  border-radius: 16px;
  background: var(--tile);
  overflow: hidden;
}

.stage__ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* The notes at the top of the stage, one under the other, so none can cover the AI notice on a narrow screen. */
.stage__notes {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  pointer-events: none;
}

.stage__ai,
.stage__seen,
.stage__recording {
  margin: 0;
  padding: 5px 10px;
  border-radius: 8px;
  background: rgba(17, 20, 24, 0.72);
  font-size: 13px;
  line-height: 1.4;
}

.stage__recording {
  position: relative;
  padding-left: 26px;
}

.stage__recording::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--coral);
}

/* What the avatar is doing, under the ring. */
.stage__state {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 71%;
  margin: 0;
  text-align: center;
  font: 400 19px/1.35 var(--display);
}

.stage__face {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
}

/* With the person's own view at the bottom right, the note keeps clear of it. */
.stage:has(.stage__self:not([hidden])) .stage__face {
  right: calc(max(24%, 104px) + 28px);
}

.stage__face p {
  margin: 0;
}

.stage__face-title {
  font-size: 14px;
  font-weight: 600;
}

.stage__face-text {
  max-width: 46ch;
  color: var(--mist);
  font-size: 13px;
  line-height: 1.45;
}

.stage__self {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 24%;
  min-width: 104px;
  border-radius: 10px;
  border: 1px solid var(--rule);
  transform: scaleX(-1);
}

/* The words beside the stage. */
.side__title {
  margin: 12px 0 14px;
  text-wrap: balance;
  font: 300 38px/1.12 var(--display);
  letter-spacing: -0.015em;
}

.side__lede {
  margin: 0 0 22px;
  color: var(--mist);
}

.steps {
  margin: 0 0 28px;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 10px 0 10px 40px;
  border-top: 1px solid var(--rule);
  counter-increment: step;
}

.steps li:last-child {
  border-bottom: 1px solid var(--rule);
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 24px;
  color: var(--coral);
  font: 400 17px/1.55 var(--display);
}

.controls {
  display: flex;
  gap: 12px;
}

.controls .button {
  flex: 1;
}

.option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  color: var(--mist);
  font-size: 14px;
  line-height: 1.5;
}

.option input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--coral);
}

.option--small {
  font-size: 13px;
}

/* The conversation, which scrolls inside its own box so the page never jumps when a line arrives. */
.log {
  margin-top: 32px;
}

.log__title {
  margin: 0 0 10px;
  font: 400 21px/1.3 var(--display);
}

.log__empty {
  margin: 0;
  color: var(--mist);
  font-size: 15px;
}

.log__lines {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 34vh;
  overflow-y: auto;
}

.log__lines li {
  padding: 10px 0;
  border-top: 1px solid var(--rule);
}

.log__lines .who {
  display: block;
  color: var(--mist);
  font-size: 13px;
  font-weight: 500;
}

.log__lines .from-avatar .who {
  color: var(--coral);
}

.log__lines .note {
  color: var(--mist);
  font-size: 14px;
}

.details {
  margin-top: 28px;
  border-top: 1px solid var(--rule);
  padding-top: 14px;
  color: var(--mist);
  font-size: 14px;
}

.details summary {
  cursor: pointer;
}

.details__line {
  margin: 8px 0 0;
}

.details__line:empty {
  display: none;
}

.downloads {
  margin-top: 12px;
}

.downloads__title {
  margin: 0 0 6px;
}

.downloads a {
  display: inline-block;
  margin-right: 14px;
  color: var(--paper);
}

.foot {
  width: 100%;
  max-width: 1200px;
  margin: auto auto 0;
  padding: 20px 24px 28px;
  color: var(--mist);
  font-size: 13px;
}

.foot p {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
}

/* A phone or a narrow window: the stage on top, the words under it. */
@media (max-width: 900px) {
  .call {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 0;
  }

  .stage {
    max-height: 72vh;
    aspect-ratio: 4 / 5;
  }

  .side__title {
    font-size: 30px;
    margin-top: 0;
  }

  .top {
    padding: 18px 16px;
  }

  .call,
  .foot {
    padding-left: 16px;
    padding-right: 16px;
  }

  .top__note {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .button {
    transition: none;
  }
}
