/*
 * portico.chat: one screen, styled like the Portico app. The tokens below are the app's own, copied from
 * server/src/web/client/base.css in king-of-the-grackles/portico. The app is light only, so this page is too.
 */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/site/manrope-latin.woff2") format("woff2");
}

:root {
  --teal: #1f6f5c;
  --teal-dark: #185a4a;
  --teal-wash: #eef4f1;
  --ink: #102b25;
  --ink-soft: #2f4640;
  --muted: #4e625c;
  --line: #c9d1c7;
  --hairline: rgba(16, 43, 37, 0.1);
  --canvas: #e9ece6;
  --card: #f7f8f5;
  --surface: #ffffff;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font: "Manrope", system-ui, sans-serif;
  /* The app has no mono token: its code uses the browser's monospace. */
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 32px);
  color-scheme: light;
}

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

html {
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 24px;
}

/* The agent traffic behind the page, drawn in this element's color. Dimmed, and dimmer still behind the words. */
.traffic {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  color: var(--teal);
  opacity: 0.8;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 62% 58% at 50% 48%, rgb(0 0 0 / 0.14), #000 100%);
  mask-image: radial-gradient(ellipse 62% 58% at 50% 48%, rgb(0 0 0 / 0.14), #000 100%);
}

header,
main,
footer {
  position: relative;
  z-index: 1;
}

a {
  color: var(--teal);
  text-decoration: none;
}

a:hover {
  color: var(--teal-dark);
}

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

/* ---- Top: the wordmark and Sign in ---- */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1440px;
  margin: 0 auto;
  padding: 16px var(--gutter) 0;
}

/* The app's mark, with the name beside it as in the app's side bar. */
.wordmark,
.wordmark:hover {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
  font-size: 18px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.wordmark img {
  display: block;
  flex: none;
}

/* The app's buttons: Sign in is its secondary button, Copy its primary one. */
.sign-in,
.prompt button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--teal);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 300ms var(--ease),
    transform 300ms var(--ease);
}

.sign-in:active,
.prompt button:active {
  transform: scale(0.98);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* The app's link button: no border, and a wash behind it on hover. */
.quiet {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  transition: background-color 300ms var(--ease);
}

.quiet:hover {
  background: var(--teal-wash);
  color: var(--teal);
}

.sign-in {
  background: var(--surface);
  color: var(--teal);
}

.sign-in:hover {
  background: var(--teal-wash);
  color: var(--teal);
}

.prompt button {
  min-width: 96px;
  background: var(--teal);
  color: #ffffff;
}

.prompt button:hover {
  background: var(--teal-dark);
}

/* ---- The pitch ---- */
main {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(16px, 2.6vh, 24px);
  padding: clamp(8px, 2vh, 32px) var(--gutter) clamp(16px, 5vh, 48px);
  text-align: center;
}

h1 {
  max-width: 19ch;
  margin: 0;
  font-size: clamp(2.3rem, 1.15rem + 5vw, 4.5rem);
  font-weight: 700;
  line-height: 1.06;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

/*
 * The end of the headline, on a line of its own so the words above never move when it changes. The script swaps
 * the word: the old one leaves upward and the new one arrives from below.
 */
.place {
  display: block;
  overflow: hidden;
  /* Room for descenders, which the tight line height would clip. */
  padding-bottom: 0.12em;
  margin-bottom: -0.12em;
  color: var(--teal);
  white-space: nowrap;
}

.place > span {
  display: inline-block;
  transition:
    transform 420ms var(--ease),
    opacity 300ms var(--ease);
}

.place > .leaving {
  opacity: 0;
  transform: translateY(-55%);
}

.place > .arriving {
  opacity: 0;
  transform: translateY(55%);
  transition: none;
}

.subhead {
  max-width: 656px;
  margin: 0;
  color: var(--ink-soft);
  font-size: clamp(16px, 0.94rem + 0.3vw, 18px);
  line-height: 28px;
  text-wrap: pretty;
}

/* ---- The copy box: the one thing to do here ---- */
.prompt {
  width: min(100%, 752px);
  margin-top: clamp(4px, 1.6vh, 16px);
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px var(--hairline),
    0 8px 24px rgba(16, 43, 37, 0.12);
  text-align: left;
  transition: box-shadow 300ms var(--ease);
}

.prompt.copied {
  box-shadow:
    0 0 0 2px var(--teal),
    0 8px 24px rgba(16, 43, 37, 0.12);
}

.prompt-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 8px 8px 8px 24px;
  border-bottom: 1px solid var(--hairline);
  background: var(--card);
}

#prompt-label {
  color: var(--teal);
  font-size: 12px;
  line-height: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.prompt pre {
  position: relative;
  margin: 0;
  padding: clamp(16px, 2.4vh, 24px) 24px clamp(16px, 2.6vh, 24px) 48px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(15px, 0.88rem + 0.35vw, 18px);
  line-height: 28px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.prompt pre::before {
  content: ">";
  position: absolute;
  left: 24px;
  color: var(--teal);
  font-weight: 700;
}

.prompt code {
  font: inherit;
}

.prompt .url {
  color: var(--teal);
  font-weight: 600;
}

/* The cursor after the line. The negative margin keeps it from taking a line of its own. */
.prompt code::after {
  content: "";
  display: inline-block;
  width: 0.55em;
  height: 1.1em;
  margin: 0 -0.9em 0 0.35em;
  background: var(--teal);
  vertical-align: text-bottom;
  animation: blink 1.15s steps(1) infinite;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

/*
 * ---- The agents it works with ----
 * The icon is the app's own file, shown the way the app shows a small logo (.logo-sm): a rounded square with a
 * hairline ring and no color treatment, with the name beside it.
 */
.harnesses {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  max-width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
}

.harnesses li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 24px;
}

.harnesses img {
  display: block;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--hairline);
  object-fit: cover;
}

/* ---- The foot ---- */
footer {
  padding: 0 var(--gutter) clamp(12px, 2.2vh, 24px);
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

footer p {
  margin: 0;
}

/* Terms and Privacy. The padding gives a finger room, and the margin takes that room back from the layout. */
footer a {
  display: inline-block;
  margin: -12px 0;
  padding: 12px 6px;
  font-weight: 600;
}

/*
 * ---- The legal pages ----
 * A long page to read, not a screen to act on: one column at a reading width, set left, on the app's card.
 */
.doc {
  display: block;
  padding: clamp(16px, 4vh, 40px) var(--gutter) clamp(32px, 8vh, 72px);
  text-align: left;
}

.doc article {
  max-width: 752px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 56px);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--hairline);
  color: var(--ink-soft);
  overflow-wrap: break-word;
}

.doc h1 {
  max-width: none;
  margin: 0 0 8px;
  color: var(--ink);
  font-size: clamp(2rem, 1.4rem + 2.6vw, 2.75rem);
  line-height: 1.1;
  text-wrap: balance;
}

.doc h2 {
  margin: 40px 0 12px;
  color: var(--ink);
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.doc h3 {
  margin: 28px 0 8px;
  color: var(--ink);
  font-size: 17px;
  line-height: 24px;
  font-weight: 700;
}

.doc :is(h1, h2, h3) {
  scroll-margin-top: 16px;
}

.doc p,
.doc ul,
.doc ol {
  margin: 0 0 16px;
  line-height: 26px;
}

.doc ul,
.doc ol {
  padding-left: 24px;
}

.doc li {
  margin-bottom: 8px;
}

.doc li > :is(ul, ol) {
  margin-top: 8px;
}

.doc h1 + p {
  color: var(--muted);
}

.doc strong {
  color: var(--ink);
}

.doc a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.doc hr {
  margin: 40px 0 24px;
  border: 0;
  border-top: 1px solid var(--line);
}

.doc hr ~ p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 20px;
}

@media (max-width: 600px) {
  /*
   * On a phone the agents are tiles, icon over name, four across and two down. Every cell is the same width,
   * so the two rows line up and the block is as wide as the copy box above it.
   */
  .harnesses {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px 4px;
    width: 100%;
    font-size: 12px;
    line-height: 16px;
  }

  .harnesses li {
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
  }

  .harnesses img {
    width: 32px;
    height: 32px;
    border-radius: 8px;
  }

  .prompt pre {
    padding-right: 16px;
    padding-left: 40px;
  }

  .prompt pre::before {
    left: 16px;
  }

  .prompt-bar {
    padding-left: 16px;
  }
}

/* The narrowest phones: keep the label on one line and the address on one line with its comma. */
@media (max-width: 380px) {
  main {
    padding-bottom: 20px;
  }

  #prompt-label {
    font-size: 11px;
    letter-spacing: 0.04em;
  }

  .prompt-bar {
    gap: 8px;
  }

  .prompt pre {
    padding-top: 12px;
    padding-bottom: 12px;
    font-size: 14px;
    line-height: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
