/* The window in the landing page's band (docs/site.md): the app's own window drawn small, a bot's chat open and
   its sidebar's bots alive. It is dark by day too, as the app is, and every size in it is an em of a type size
   that follows the window's width, so the whole of it scales as one. On a phone only its sidebar is shown. */

.win {
  position: relative;
  width: 100%;
  aspect-ratio: 920 / 560;
  container-type: inline-size;
  text-align: left;
}
.win-in {
  --w-page: #0e0e0e;
  --w-side: #151515;
  --w-soft: #1f1f1f;
  --w-line: rgba(255, 255, 255, 0.09);
  --w-ink: #ececea;
  --w-mute: #8c8c89;
  height: 100%;
  display: grid;
  grid-template: 3.4em 1fr / 4.2em 21em 1fr;
  font-size: calc(100cqw / 92);
  line-height: 1.45;
  color: var(--w-ink);
  background: var(--w-page);
  border: 1px solid var(--w-line);
  border-radius: 1.3em;
  box-shadow: 0 2.4em 6em rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.win-in :is(ul, li) {
  margin: 0;
  padding: 0;
  list-style: none;
}
.win-in :is(i, em) {
  font-style: normal;
}
.win-in :is(strong, b) {
  font-weight: 600;
}
.win-in [data-face] {
  display: block;
  flex: none;
  position: relative;
}

.tabs {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0 1.3em;
  background: var(--w-side);
  border-bottom: 1px solid var(--w-line);
}
.tabs > i {
  width: 0.95em;
  height: 0.95em;
  border-radius: 50%;
  background: #333;
}
.tabs > i:nth-child(3) {
  margin-right: 3.2em;
}
.tabs span {
  display: flex;
  align-items: center;
  gap: 0.6em;
  height: 2.5em;
  padding: 0 1.1em;
  border-radius: 0.8em;
  font-size: 1.15em;
  color: var(--w-mute);
}
.tabs span.on {
  background: var(--w-soft);
  color: var(--w-ink);
  min-width: 13em;
}
.tabs [data-face] {
  width: 1.5em;
  height: 1.5em;
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8em;
  padding-top: 1em;
  background: var(--w-side);
}
.rail b {
  display: grid;
  place-items: center;
  width: 2.5em;
  height: 2.5em;
  border-radius: 0.8em;
  font-size: 1.1em;
  color: var(--w-mute);
}
.rail b.on {
  background: var(--w-soft);
  color: var(--w-ink);
}

.side {
  padding: 1.2em 0.8em;
  background: var(--w-side);
  border-right: 1px solid var(--w-line);
  overflow: hidden;
}
.side > strong {
  display: block;
  padding: 0 0.6em 0.7em;
  font-size: 1.3em;
}
.side > small {
  display: block;
  padding: 1.3em 0.7em 0.5em;
  font-size: 1.05em;
  color: var(--w-mute);
}
.nav li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 2.35em;
  padding: 0 0.7em;
  font-size: 1.2em;
  color: var(--w-mute);
}
.nav em {
  min-width: 1.6em;
  border-radius: 1em;
  background: #f0a63a;
  color: #111;
  font-size: 0.8em;
  font-weight: 700;
  text-align: center;
}
.bots li {
  display: flex;
  align-items: center;
  gap: 0.9em;
  height: 4.5em;
  padding: 0 0.7em;
  border-radius: 1em;
}
.bots li.on {
  background: var(--w-soft);
}
.bots [data-face] {
  width: 2.7em;
  height: 2.7em;
}
.bots span {
  flex: 1;
  min-width: 0;
  display: grid;
}
.bots strong {
  font-size: 1.2em;
}
.bots i {
  font-size: 1.05em;
  color: var(--w-mute);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bots time {
  align-self: start;
  margin-top: 0.9em;
  font-size: 0.95em;
  color: var(--w-mute);
}

.main {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 0;
}
.main header {
  display: flex;
  align-items: center;
  gap: 0.8em;
  padding: 1em 1.6em;
  border-bottom: 1px solid var(--w-line);
}
.main header [data-face] {
  width: 2em;
  height: 2em;
}
.main header strong {
  flex: 1;
  font-size: 1.35em;
}
.main header i {
  font-size: 1.05em;
  color: var(--w-mute);
}
.talk {
  display: grid;
  align-content: end;
  gap: 1em;
  padding: 0 7em 1.4em;
  overflow: hidden;
}
.talk :is(p, li) {
  font-size: 1.22em;
  color: var(--w-ink);
}
.talk small {
  margin-top: 0.6em;
  font-size: 1.05em;
  color: var(--w-mute);
}
.talk ul {
  display: grid;
  gap: 0.5em;
  padding-left: 1.2em;
}
.talk li li,
.talk ul li {
  font-size: 1.22em;
}
.talk code {
  padding: 0.1em 0.4em;
  border-radius: 0.4em;
  background: var(--w-soft);
  font:
    0.92em ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
}
.talk .you {
  justify-self: end;
  max-width: 80%;
  padding: 0.6em 1em;
  border-radius: 1.2em;
  background: var(--w-soft);
}
.box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1em;
  margin: 0 5.4em 1.4em;
  padding: 1.1em 1.3em;
  border-radius: 1.4em;
  background: var(--w-side);
  border: 1px solid var(--w-line);
}
.box span {
  flex: 1 0 100%;
  font-size: 1.2em;
  color: var(--w-mute);
}
.box em {
  flex: 1;
  font-size: 1.05em;
  color: var(--w-mute);
}
.box b {
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background: var(--w-ink);
}

/* The app itself, over the drawn window once it has loaded (src/window.ts): drawn at a desk's size and scaled
   by --k to the scene's window. It is covered, and so only looked at, until it is pressed. */
.real {
  position: absolute;
  inset: 0;
  border-radius: calc(100cqw / 92 * 1.3);
  overflow: hidden;
  /* The app follows the reader's day or night, so what stands behind it does too: a dark ground under a light app
     showed as a black edge. */
  background: light-dark(#f4f4f2, #0e0e0e);
  border: 1px solid rgba(128, 128, 128, 0.16);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transition: opacity 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.win.live .real {
  opacity: 1;
}
.win.live .win-in {
  visibility: hidden;
}
.real iframe {
  display: block;
  border: 0;
  transform-origin: 0 0;
  transform: scale(var(--k, 1));
  background: light-dark(#f4f4f2, #0e0e0e);
}
.try {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end center;
  padding: 0 0 16px;
  background: transparent;
}
.try:active {
  transform: none;
}
.try span {
  padding: 8px 14px;
  border-radius: 999px;
  background: #ececea;
  color: #111;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 200ms;
}
.try:hover span,
.try:focus-visible span {
  opacity: 1;
}
.win.yours .try {
  display: none;
}

@media (max-width: 640px) {
  .win {
    width: min(100%, 20rem);
    margin-inline: auto;
    aspect-ratio: auto;
  }
  .win-in {
    display: block;
    font-size: calc(100cqw / 22.6);
  }
  .tabs,
  .rail,
  .main,
  .nav,
  .side > strong {
    display: none;
  }
  .side > small {
    padding-top: 0.2em;
  }
  .side {
    border-right: 0;
  }
}

/* On a wide screen the app itself takes the window's place (src/window.ts), so the drawn one is not shown first and
   then swapped: only an empty window of the app's own ground waits for it. Where the app was not built, the drawn
   window is marked and shown. */
@media (min-width: 641px) {
  .js .win:not(.drawn) .win-in {
    background: light-dark(#f4f4f2, #0e0e0e);
    border-color: rgba(128, 128, 128, 0.16);
  }
  .js .win:not(.drawn) .win-in > * {
    visibility: hidden;
  }
}
