/* /start: the visa application as one chat (src/components/StartPage.astro).
   Mobile first: the page is the chat. From 641px it sits in the home page's
   bordered sheet, with the chat as a centred column. */

:root {
  --s-ink: #111;
  --s-muted: #71717a;
  --s-line: #e4e4e7;
  --s-sheet: #fbfbfa;
  --s-column: 640px;
  --s-height: 100dvh;
}

/* Moving between the site's pages (the home page's "Continue", "Home"):
   one fades into the other, with no blank frame between them (global.css
   has the same for the home page) */
@view-transition {
  navigation: auto;
}

/* The next page fades in over the one left, which goes a beat later:
   never a blank white frame between them */
::view-transition-old(root) {
  animation: vt-out 0.25s 0.05s ease both;
}

::view-transition-new(root) {
  animation: vt-in 0.25s ease both;
}

@keyframes vt-out {
  to {
    opacity: 0;
  }
}

@keyframes vt-in {
  from {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}

/* Everything is scoped to the app: the home page carries it too
   (StartOverlay.astro). Its own page marks <html class="s-document"> */
.s-page,
.s-page *,
.s-page *::before,
.s-page *::after {
  box-sizing: border-box;
}

.s-page [hidden] {
  display: none !important;
}

html.s-document,
html.s-document body {
  height: 100%;
}

html.s-document body {
  margin: 0;
  background: #fff;
  overflow: hidden;
}

:where(.s-page) button,
:where(.s-page) input {
  font: inherit;
  color: inherit;
}

:where(.s-page) button {
  cursor: pointer;
}

/* A tap shows itself (:active), not as the phone's grey box; no wait for a
   double tap to zoom */
:where(.s-page) :is(a, button, label) {
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Small controls are 44px to a finger, whatever they look like: an
   invisible frame around each takes the tap */
.s-back,
.s-status,
.s-attach,
.s-send {
  position: relative;
}

.s-back::before,
.s-status::before,
.s-attach::before,
.s-send::before {
  content: '';
  position: absolute;
  inset: -7px -2px;
}

.s-status.is-guest::before {
  inset: -5px;
}

.s-attach::before {
  inset: -2px -5px;
}

.s-send::before {
  inset: -2px;
}

:where(.s-page) :is(h1, h2, h3, p, ul) {
  letter-spacing: normal;
}

/* ---------- The sheet ---------- */

.s-page {
  position: relative;
  color: var(--s-ink);
  font-family: 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  text-align: left;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
  height: var(--s-height);
  background: var(--s-sheet);
  overflow: hidden;
  isolation: isolate;
}

/* A landmark engraving, faint and grey behind the chat, fading out on every
   side; the two layers cross-fade when the country is picked */
.s-art {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  transition: opacity 0.6s ease;
}

/* Until its picture is ready (StartApp.astro): it fades in, never pops */
.s-art.is-waiting {
  opacity: 0;
}

/* On a phone the landmark stays where it is while the keyboard comes and
   goes: it is not cut to the sheet, which shrinks above the keyboard, and
   keeps the height it had without one (--s-art-height, src/start/app.js).
   Redrawn to the sheet's new height, it jumped in size and left a blank
   strip as the keyboard went down. */
@media (max-width: 640px) {
  html.s-document body {
    background: var(--s-sheet);
  }

  .s-art {
    position: fixed;
    inset: 0 0 auto;
    height: var(--s-art-height, var(--s-height));
  }
}

/* The home page's visa stamps, drifting, until a country with a landmark is
   picked: the hero and the chat it opens are one surface */
.s-stamps {
  position: absolute;
  inset: 0;
  background: url('/images/visa-stamps-bg.webp') center / 300px repeat;
  filter: grayscale(100%);
  opacity: 0.07;
  animation: s-drift 80s linear infinite;
  transition: opacity 0.9s ease;
}

.s-page.has-art .s-stamps {
  opacity: 0;
}

@keyframes s-drift {
  from {
    background-position: 0 0;
  }

  to {
    background-position: -300px 0;
  }
}

.s-art-layer {
  position: absolute;
  inset: 0;
  background: var(--s-art) center 62% / min(170%, 760px) auto no-repeat;
  opacity: 0;
  /* Each landmark is a layer of its own, drawn once and only faded: a
     phone that redrew it (as it did with mix-blend-mode, for a keyboard
     or the other landmark fading) showed the sheet bare for a few frames.
     The engravings are grey on white, so at this opacity no blending is
     needed to sit on the sheet. */
  will-change: opacity;
  transform: translateZ(0);
  /* The same both ways: one landmark leaves as the next arrives, with
     the conversation's own fade (not long enough to see both at once) */
  transition: opacity 0.9s ease-in-out;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 20%, #000 80%, transparent), linear-gradient(to bottom, transparent 8%, #000 30%, #000 78%, transparent 96%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 20%, #000 80%, transparent), linear-gradient(to bottom, transparent 8%, #000 30%, #000 78%, transparent 96%);
  mask-composite: intersect;
}

.s-art-layer.is-on {
  opacity: 0.15;
}

/* The Statue of Liberty, before a country is picked: tall, so it stands
   higher and larger than the other landmarks, its whole pedestal showing,
   and only a short fade at the top so the torch stays */
.s-art-layer[data-art="statue-of-liberty"] {
  background-size: auto min(88%, 760px);
  background-position: center 22%;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 20%, #000 80%, transparent), linear-gradient(to bottom, transparent 2%, #000 14%, #000 84%, transparent 98%);
  mask-image: linear-gradient(to right, transparent, #000 20%, #000 80%, transparent), linear-gradient(to bottom, transparent 2%, #000 14%, #000 84%, transparent 98%);
}

/* ---------- Top bar ---------- */

/* The logo is the mark alone, ringed like an avatar, as far from the
   sheet's left edge as from its top */
.s-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(16px + env(safe-area-inset-top)) 16px 10px;
  flex: none;
}

/* Back to the home page: a chevron, the house, "Home" */
.s-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  height: 30px;
  margin-left: -4px;
  padding: 0 8px 0 2px;
  border-radius: 999px;
  color: var(--s-ink);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s ease;
}

@media (hover: hover) {
  .s-back:hover {
    background: rgba(17, 17, 17, 0.05);
  }
}

.s-back-chevron {
  color: var(--s-muted);
}

/* While a conversation is fetched, a ring turns where the house is */
.s-back-icon {
  position: relative;
  display: inline-flex;
}

.s-back-icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border: 1.5px solid #d4d4d8;
  border-top-color: var(--s-ink);
  border-radius: 50%;
  opacity: 0;
}

.s-page.is-loading .s-back-icon svg {
  opacity: 0;
}

.s-page.is-loading .s-back-icon::after {
  opacity: 1;
  animation: s-spin 0.8s linear infinite;
}

.s-top-right {
  display: flex;
  align-items: center;
  gap: 10px;
  /* As tall as the home page's nav buttons, with or without the status */
  height: 30px;
}

/* Where the application stands: the country's flag, its name and how far
   along; opens what is saved */
.s-status-wrap {
  position: relative;
}

.s-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 8px 0 9px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.78rem;
  font-weight: 600;
}

/* Signed out: the home page's button with three dots, and under it the
   home page's menu, to the pixel (public/css/site.css): the same pill, the
   same dots, the same card as wide as its longest link */
.s-status-dots {
  display: none;
}

.s-status.is-guest {
  justify-content: center;
  width: 34px;
  height: 30px;
  padding: 0;
  border-color: rgba(17, 17, 17, 0.12);
  background: rgba(255, 255, 255, 0.7);
  color: #111;
  transition: background 0.2s ease;
}

.s-status.is-guest > * {
  display: none;
}

.s-status.is-guest .s-status-dots {
  display: block;
  width: 18px;
  height: 18px;
  stroke-width: 2.4;
}

.s-status.is-guest[aria-expanded='true'] {
  background: #111;
  color: #fff;
}

/* Someone signed in sees no dots while their application loads */
.s-page.is-loading .s-status.is-guest {
  visibility: hidden;
}

.s-menu:not(.is-guest) .s-menu-site,
.s-menu.is-guest > :not(.s-menu-site) {
  display: none;
}

.s-menu.is-guest {
  width: max-content;
  padding: 6px;
  border-color: rgba(17, 17, 17, 0.08);
  background: rgba(255, 255, 255, 0.96);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  box-shadow:
    0 4px 12px rgba(17, 17, 17, 0.06),
    0 16px 40px rgba(17, 17, 17, 0.12);
}

.s-menu.is-guest .s-menu-item {
  width: auto;
  padding: 10px 14px;
  color: #111;
  font-size: 0.95rem;
  line-height: 1.3;
}

.s-menu.is-guest .s-menu-item svg {
  width: 17px;
  height: 17px;
  color: inherit;
  stroke-width: 1.9;
  opacity: 0.7;
}

.s-status-flag {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(17, 17, 17, 0.1);
}

/* How far along: a ring filled that far, with the percent beside it */
.s-meter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  margin-left: auto;
  color: var(--s-muted);
  font-size: 0.78rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.s-ring {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: conic-gradient(var(--s-ink) calc(var(--s-progress, 0) * 1%), #e0e0e4 0);
  -webkit-mask: radial-gradient(circle, transparent 4.2px, #000 4.7px);
  mask: radial-gradient(circle, transparent 4.2px, #000 4.7px);
}

.s-status-chevron {
  color: var(--s-muted);
  transition: transform 0.15s ease;
}

.s-status[aria-expanded='true'] .s-status-chevron {
  transform: rotate(180deg);
}

.s-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 5;
  width: min(280px, calc(100vw - 32px));
  padding: 14px;
  border: 1px solid var(--s-line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(17, 17, 17, 0.12);
  animation: s-in 0.18s ease both;
}

.s-menu p {
  margin: 0;
}

.s-menu {
  max-height: calc(var(--s-height) - 90px);
  overflow-y: auto;
  padding: 8px;
}

/* Logging out, apart from the applications */
.s-menu .s-menu-logout {
  margin-top: 6px;
  border-top: 1px solid #ececee;
  border-radius: 0 0 10px 10px;
  padding-top: 13px;
}

.s-menu-heading {
  padding: 8px 10px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--s-muted);
}

/* One row of the menu: an application, a link, an action */
.s-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--s-ink);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
}

@media (hover: hover) {
  .s-menu-item:hover {
    background: #f4f4f5;
  }
}

.s-menu-item:active {
  background: #f4f4f5;
}

.s-menu-item svg {
  flex: none;
  color: #52525b;
}

.s-menu-application.is-current {
  background: #f4f4f5;
}

.s-menu-words {
  display: grid;
  min-width: 0;
}

.s-menu-words small {
  color: var(--s-muted);
  font-size: 0.76rem;
  font-weight: 400;
}

/* An application whose country is not picked yet: no flag */
.s-menu-blank {
  flex: none;
  width: 20px;
  height: 20px;
  border: 1px dashed #c4c4c8;
  border-radius: 50%;
}

/* Room between the applications and the way to start another */
#s-menu-new {
  margin-top: 6px;
}

@media (max-width: 480px) {
  .s-status.has-flag .s-status-label {
    display: none;
  }
}

/* While an application loads with nothing kept to show: no text box yet,
   and the ring by "Home" turns */
.s-page.is-loading .s-dock {
  visibility: hidden;
}

/* The line icons (lucide), drawn from the sprite */
.s-sprite {
  position: absolute;
}

.s-page svg:has(> use),
.s-menu-site svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.s-lang {
  /* Hidden for now: the switch stays in the page */
  display: none;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}

.s-lang-option {
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(17, 17, 17, 0.55);
}

.s-lang-option.is-active {
  background: var(--s-ink);
  color: #fff;
}

/* ---------- The chat ---------- */

.s-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Messages fade out under the top bar: a band of the sheet's colour hung
   under the bar, over the top of the chat. (Not a mask on the scroller,
   which would make the phone redraw the whole conversation on every frame
   of a scroll; and not a sticky band inside it, which iOS drew as a pale
   block over the gap a pull-down opens at the top of the chat.) */
.s-top {
  position: relative;
  z-index: 2;
}

.s-top::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 28px;
  background: linear-gradient(var(--s-sheet), rgba(251, 251, 250, 0));
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

/* Only once the chat is scrolled: before that nothing is under the bar,
   and the band would cut across the landmark behind it */
.s-page.is-scrolled .s-top::after {
  opacity: 1;
}

/* Signed out, before any message, there is nothing to fade: no band over
   the statue */
.s-page.is-hero .s-top::after {
  content: none;
}

.s-thread {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: var(--s-column);
  min-height: 100%;
  margin: 0 auto;
  padding: 28px 16px 16px;
  /* A short chat sits at the bottom, right above the text box */
  justify-content: flex-end;
}

/* One conversation gives way to another: out, then back at its end */
.s-thread {
  transition: opacity 0.32s ease;
}

.s-thread.is-leaving {
  opacity: 0;
}

.s-thread.is-arriving {
  animation: s-arrive 0.45s ease;
}

/* Only a fade: moved even 8px down while it fades in, the conversation
   reached further down the scroller for as long, so it was held at an end
   8px too low and dropped into place once the animation was done */
@keyframes s-arrive {
  from {
    opacity: 0;
  }
}

.s-msg {
  display: flex;
  animation: s-in 0.28s ease both;
}

.s-msg.is-still {
  animation: none;
}

.s-msg--user {
  justify-content: flex-end;
  /* A little more air around the visitor's own answers */
  margin: 4px 0;
}

.s-bubble {
  max-width: 86%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.s-msg--bot .s-bubble {
  border-radius: 18px 18px 18px 4px;
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--s-line);
}

.s-msg--user .s-bubble {
  border-radius: 18px 18px 4px 18px;
  background: var(--s-ink);
  color: #fff;
}

/* An answer still being given, part by part */
.s-msg--draft .s-bubble {
  opacity: 0.6;
}

.s-bubble b {
  font-weight: 600;
}

.s-bubble a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.s-bubble ul {
  margin: 0;
  padding-left: 1.15em;
}

.s-bubble li + li {
  margin-top: 4px;
}

/* A file sent in the chat */
.s-file {
  display: flex;
  align-items: center;
  gap: 10px;
}

.s-file svg {
  flex: none;
  opacity: 0.8;
}

.s-file-name {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
}

/* A quiet line across the chat: what the page itself says */
.s-msg--note {
  justify-content: center;
  padding: 2px 0;
  color: var(--s-muted);
  font-size: 0.78rem;
  text-align: center;
}

/* The bot is writing */
.s-typing {
  display: inline-flex;
  gap: 4px;
  padding: 14px;
}

.s-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #a1a1aa;
  animation: s-typing 1.2s ease-in-out infinite;
}

.s-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.s-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

/* The answers to tap, right under the question and as wide as its bubble
   may be. Short ones sit side by side (showChoices in src/start/app.js) */
.s-choices {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  width: 86%;
  margin-top: 2px;
  animation: s-in 0.28s ease both;
}

/* An answer is on its way: the buttons fade where they stand, before the
   conversation moves into their room (src/start/app.js leaveChoices) */
.s-choices.is-leaving {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.13s ease;
}

.s-choices--two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.s-choices--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.s-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 9px 14px;
  border: 1px solid var(--s-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.93rem;
  font-weight: 500;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

/* One line: the columns step down until it fits (fitChoices); a sentence
   too long for one column is the only label that wraps */
.s-chip-label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.s-choices.is-wrapping .s-chip-label {
  overflow: visible;
  overflow-wrap: anywhere;
  white-space: normal;
}

.s-chip-icon {
  display: grid;
  flex: none;
  color: #52525b;
}

/* A country's flag, as a circle cut from its middle */
.s-chip-flag {
  flex: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(17, 17, 17, 0.1);
}

/* A number alone: centred */
.s-choices--three .s-chip {
  justify-content: center;
}

@media (hover: hover) {
  .s-chip:hover {
    border-color: var(--s-ink);
  }
}

.s-chip:active {
  transform: scale(0.985);
}

.s-chip.is-picked {
  border-color: var(--s-ink);
  background: var(--s-ink);
  color: #fff;
}

.s-chip.is-picked .s-chip-icon {
  color: inherit;
}

.s-chip--primary {
  grid-column: 1 / -1;
  justify-content: center;
  border-color: var(--s-ink);
  background: var(--s-ink);
  color: #fff;
  font-weight: 600;
}

/* A long message (a summary, a document list) takes the column's width */
.s-msg--wide .s-bubble {
  width: 100%;
  max-width: 100%;
  padding: 14px;
}

.s-bubble table {
  width: 100%;
  border-collapse: collapse;
}

.s-bubble td {
  padding: 4px 8px 4px 0;
  vertical-align: top;
}

/* ---------- The text box ---------- */

.s-dock {
  position: relative;
  flex: none;
  width: 100%;
  max-width: var(--s-column);
  margin: 0 auto;
  padding: 4px 12px calc(10px + env(safe-area-inset-bottom));
}

.s-box {
  border: 1px solid var(--s-line);
  border-radius: 26px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(17, 17, 17, 0.06);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.s-box:focus-within {
  border-color: #a1a1aa;
  box-shadow: 0 6px 28px rgba(17, 17, 17, 0.1);
}

.s-box.is-shaking {
  animation: s-shake 0.3s ease;
}

.s-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px 6px 18px;
}

/* The paperclip: a document, in place of words */
.s-attach {
  display: grid;
  place-items: center;
  flex: none;
  width: 34px;
  height: 40px;
  margin-left: -8px;
  color: #71717a;
  cursor: pointer;
  transition: color 0.15s ease;
}

@media (hover: hover) {
  .s-attach:hover {
    color: var(--s-ink);
  }
}

.s-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}

/* A file held over the page: the box says it will take it */
.s-box.is-over {
  border-color: var(--s-ink);
  border-style: dashed;
}

.s-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0;
  border: 0;
  outline: 0;
  background: none;
  /* 16px: iOS zooms the page into anything smaller */
  font-size: 16px;
}

/* Chrome paints a filled-in value's box blue: kept the box's own white */
.s-input:-webkit-autofill,
.s-input:-webkit-autofill:hover,
.s-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--s-ink);
  -webkit-box-shadow: 0 0 0 1000px #fff inset;
  box-shadow: 0 0 0 1000px #fff inset;
  caret-color: var(--s-ink);
  transition: background-color 100000s;
}

.s-input::placeholder {
  color: #a1a1aa;
}

/* The code, or words in place of it: plain text, even digits */
.s-box--code .s-input {
  font-variant-numeric: tabular-nums;
}

.s-send {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--s-ink);
  color: #fff;
  transition: opacity 0.15s ease, transform 0.1s ease;
}

.s-send:active {
  transform: scale(0.94);
}

.s-box.is-empty .s-send {
  opacity: 0.25;
}

.s-under {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 18px;
  min-height: 30px;
  padding-top: 6px;
}

/* With nothing to offer under the box, no strip is kept for it */
.s-under:empty {
  display: none;
}

.s-under button {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--s-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

@media (hover: hover) {
  .s-under button:hover {
    color: var(--s-ink);
  }
}

.s-error {
  margin: 0 0 6px;
  padding: 0 18px;
  color: #c2410c;
  font-size: 0.82rem;
  font-weight: 500;
}

.s-legal {
  display: none;
  margin: 8px 0 0;
  color: var(--s-muted);
  font-size: 0.75rem;
  text-align: center;
}

.s-legal a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* A message came while the visitor reads further up: the way down */
.s-new {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px 0 10px;
  border: 1px solid var(--s-line);
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 6px 20px rgba(17, 17, 17, 0.12);
  font-size: 0.82rem;
  font-weight: 600;
  transform: translateX(-50%);
  animation: s-in 0.2s ease both;
}

.s-new::before {
  content: '';
  position: absolute;
  inset: -4px;
}

/* A file on its way: a ring filled as far as it is sent */
.s-file-progress {
  flex: none;
  width: 18px;
  height: 18px;
  margin-left: auto;
  border-radius: 50%;
  background: conic-gradient(currentColor calc(var(--s-progress, 0) * 1%), rgba(255, 255, 255, 0.25) 0);
  -webkit-mask: radial-gradient(circle, transparent 5.5px, #000 6px);
  mask: radial-gradient(circle, transparent 5.5px, #000 6px);
}

/* ---------- Before the first answer ---------- */

.s-hero {
  display: none;
  width: 100%;
  max-width: var(--s-column);
  margin: 0 auto;
  padding: 0 24px 22px;
  text-align: center;
}

.s-hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 6.4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-wrap: balance;
}

.s-hero p {
  margin: 12px 0 0;
  color: var(--s-muted);
  font-size: 1.02rem;
  text-wrap: balance;
}

/* The greeting and the text box sit together in the middle of the sheet */
.s-page.is-hero {
  justify-content: center;
}

.s-page.is-hero .s-top {
  position: absolute;
  inset: 0 0 auto;
}

.s-page.is-hero .s-scroll,
.s-page.is-hero .s-under {
  display: none;
}

.s-page.is-hero .s-hero {
  display: block;
  animation: s-in 0.5s ease both;
}

.s-page.is-hero .s-legal {
  display: block;
}

.s-page.is-hero .s-dock {
  /* A touch above the true middle, which reads as centred (9vh sat too
     high on a phone, the lower half left empty) */
  margin-bottom: 1vh;
  animation: s-in 0.5s 0.08s ease both;
}

@keyframes s-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@keyframes s-typing {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@keyframes s-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes s-shake {
  25% {
    transform: translateX(-5px);
  }

  75% {
    transform: translateX(5px);
  }
}

/* ---------- Wider screens: the home page's sheet ---------- */

@media (min-width: 641px) {
  .s-page {
    height: calc(var(--s-height) - 20px);
    margin: 10px;
    border: 1px solid #e8eaed;
    border-radius: 10px;
  }

  .s-top {
    padding: 20px 20px 10px;
  }

  .s-art-layer {
    background-size: auto min(78%, 620px);
    background-position: center 58%;
  }

  /* The greeting's second line stays one line: wider than the chat column */
  .s-hero {
    max-width: 860px;
  }

  .s-bubble {
    max-width: 78%;
  }

  .s-choices {
    width: 78%;
  }

  .s-choices--two-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .s-dock {
    padding-bottom: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .s-page.is-loading .s-back-icon::after {
    animation: none;
  }

  .s-msg,
  .s-choices,
  .s-new,
  .s-page.is-hero .s-hero,
  .s-page.is-hero .s-dock {
    animation: none;
  }

  .s-art,
  .s-art-layer,
  .s-stamps {
    transition: none;
  }

  .s-stamps {
    animation: none;
  }
}

/* The terms line breaks before the links on phones, where it would wrap
   anyway; wide screens keep it on one line */
@media (min-width: 769px) {
  .s-legal-br {
    display: none;
  }
}
