/* Landing page and web chat. Tokens and primitives come from site.css. */

:root {
  --masthead-h: 56px;
  --bubble-me: var(--day-accent);
  --bubble-me-text: #ffffff;
  --bubble-agent: #e6eaea;
  --field-bg: var(--day-bg);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* Lume is too bright to fill a whole bubble; this is the same green with the light off. */
    --bubble-me: #1d4038;
    --bubble-me-text: #e9f7f0;
    --bubble-agent: #222e3c;
    --field-bg: var(--night-sunken);
  }
}

/* Masthead */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--masthead-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand:hover {
  color: var(--text);
}

.mark {
  flex: none;
  width: 28px;
  height: 28px;
}

.mark-seconds {
  stroke: var(--signal);
}

.masthead-nav {
  display: none;
}

.masthead-nav a {
  color: var(--text);
  text-decoration: none;
}

.masthead-nav a:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

@media (min-width: 800px) {
  :root {
    --masthead-h: 72px;
  }

  .masthead-nav {
    display: flex;
    gap: 28px;
  }
}

/* Hero: the intro, the chat, and a spec sheet like the one on any watch listing. */

.hero {
  display: grid;
  gap: 28px;
  padding-block: 8px 56px;
}

/* Phone: the first screen is the claim and then the chat, which takes whatever height
   is left so the message box sits at the bottom of the screen like a messaging app.
   The height is fixed, not a minimum: a long conversation scrolls inside the chat and
   never pushes the message box off the screen. */
.hero-first {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
  height: calc(100vh - var(--masthead-h) - 24px);
  height: calc(100svh - var(--masthead-h) - 24px);
  min-height: 520px;
}

@media (min-width: 600px) {
  .hero-first {
    height: auto;
    min-height: 0;
  }
}

.hero-intro h1 {
  font-size: clamp(2.5rem, 1.1rem + 6.4vw, 4.25rem);
  letter-spacing: -0.012em;
  line-height: 0.98;
}

.lede {
  margin-top: 16px;
  max-width: 36ch;
  font-size: 1.125rem;
  line-height: 1.45;
}

@media (max-width: 379px) {
  .lede {
    font-size: 1.0625rem;
  }
}

.spec {
  display: grid;
  margin: 0;
}

.spec > div {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 16px;
  padding-block: 12px;
  border-top: 1px solid var(--border);
}

.spec > div:last-child {
  border-bottom: 1px solid var(--border);
}

.spec dt {
  color: var(--muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.spec dd {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
}

@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "intro chat"
      "spec  chat";
    gap: 36px 64px;
    align-items: start;
    padding-block: 40px 96px;
  }

  .hero-first {
    display: contents;
  }

  .hero-intro {
    grid-area: intro;
  }

  .hero .chat {
    grid-area: chat;
  }

  .spec {
    grid-area: spec;
  }

  .lede {
    font-size: 1.3125rem;
    line-height: 1.4;
  }
}

/* Chat */

.chat {
  position: relative;
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  max-height: 620px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

@media (min-width: 600px) {
  .chat {
    flex: none;
    height: 580px;
    height: clamp(380px, 100svh - 48px, 580px);
  }
}

/* Wide screens: the chat stands as tall as the column beside it (headline to the last
   line of the spec sheet), but never taller than the window, so the message box is
   always on screen. The conversation area has a zero basis so that a long conversation
   scrolls inside the panel instead of stretching the row. */
@media (min-width: 960px) {
  .chat {
    align-self: stretch;
    height: auto;
    min-height: 480px;
    max-height: 720px;
    max-height: clamp(480px, 100svh - var(--masthead-h) - 64px, 720px);
  }
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}

.chat-head .mark {
  width: 24px;
  height: 24px;
}

.chat-title {
  font-size: 1.25rem;
  line-height: 1.1;
}

.chat-status {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: right;
}

.chat .track {
  flex: none;
  border-top-color: var(--border);
  border-bottom-color: var(--border);
}

.chat-scroll {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 16px;
}

@media (min-width: 960px) {
  .chat-scroll {
    flex-basis: 0;
  }
}

.chat-scroll > * {
  flex: none;
}

/* The conversation grows up from the message box, as in any messaging app. */
.chat-empty,
.messages {
  margin-top: auto;
}

.chat-empty:not([hidden]) + .messages {
  margin-top: 0;
}

.chat-scroll:focus-visible {
  outline-offset: -3px;
  border-radius: 0;
}

.chat-empty {
  display: grid;
  gap: 12px;
}

.chat-empty > p {
  max-width: 44ch;
  color: var(--muted);
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 0;
  margin-inline: 0;
  padding: 0;
  list-style: none;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.msg--me {
  align-self: flex-end;
  align-items: flex-end;
}

.msg--agent {
  align-self: flex-start;
  align-items: flex-start;
}

/* Consecutive bubbles from the same side sit closer together. */
.msg--me + .msg--me,
.msg--agent + .msg--agent {
  margin-top: -5px;
}

.bubble {
  padding: 10px 14px;
  border-radius: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.msg--me .bubble {
  border-bottom-right-radius: 4px;
  background: var(--bubble-me);
  color: var(--bubble-me-text);
}

.msg--agent .bubble {
  border-bottom-left-radius: 4px;
  background: var(--bubble-agent);
}

.msg--me .bubble a {
  color: inherit;
}

.bubble a {
  font-weight: 500;
}

.link-host {
  opacity: 0.75;
  font-size: 0.875em;
  font-weight: 400;
}

.msg-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  margin-top: 3px;
  padding-inline: 4px;
  color: var(--muted);
  font-size: 0.8125rem;
}

.msg-meta:empty {
  display: none;
}

.msg[data-state="sending"] .bubble {
  opacity: 0.8;
}

.msg[data-state="failed"] .bubble {
  background: transparent;
  color: var(--text);
  outline: 1px dashed var(--signal);
  outline-offset: -1px;
}

.stamp {
  align-self: center;
  margin-block: 6px 2px;
  color: var(--muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums lining-nums;
}

.typing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* The one moving part on the page: a seconds hand that sweeps while a reply is on its
   way. With reduced motion it stands still and the words carry the meaning. */
.typing-dial {
  flex: none;
  width: 20px;
  height: 20px;
}

.typing-hand {
  stroke: var(--signal);
  transform-origin: 16px 16px;
  animation: sweep 2.4s linear infinite;
}

@keyframes sweep {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .typing-hand {
    animation: none;
  }
}

.chat-jump {
  position: absolute;
  left: 50%;
  bottom: 118px;
  transform: translateX(-50%);
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 6px 16px -8px rgb(18 24 33 / 50%);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.composer {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}

.composer-input {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 46px;
  max-height: 9.5em;
  padding: 11px 14px;
  border: 1px solid var(--field-border);
  border-radius: 14px;
  background: var(--field-bg);
  color: var(--text);
  /* 16px or more, or iOS zooms the page when the field takes focus. */
  font: inherit;
  font-size: 1.0625rem;
  line-height: 1.35;
  resize: none;
}

.composer-input::placeholder {
  color: var(--muted);
  opacity: 1;
}

.composer-input:focus-visible {
  outline-offset: 0;
  border-radius: 14px;
}

.composer-send {
  flex: none;
  padding-inline: 18px;
  border-radius: 14px;
}

/* The invite step stands where the message box does until a code opens the chat. */
.invite {
  display: grid;
  flex: none;
  gap: 8px;
  padding: 12px 12px 10px;
  border-top: 1px solid var(--border);
}

.invite-note,
.invite-error {
  padding-inline: 4px;
  font-size: 0.9375rem;
  line-height: 1.4;
}

.invite-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.invite-code {
  flex: 1 1 9rem;
  width: auto;
  min-width: 0;
  min-height: 46px;
  border-radius: 14px;
  background: var(--field-bg);
}

.invite-code:focus-visible {
  outline-offset: 0;
  border-radius: 14px;
}

.invite-submit {
  flex: none;
  padding-inline: 18px;
  border-radius: 14px;
}

.chat-notice {
  flex: none;
  padding: 0 16px 10px;
  color: var(--signal);
  font-size: 0.9375rem;
  font-weight: 600;
}

.chat-notice[data-tone="quiet"] {
  color: var(--muted);
  font-weight: 400;
}

.chat-foot {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 16px;
  padding: 0 16px 12px;
  font-size: 0.875rem;
}

/* Sections */

.section-title {
  font-size: clamp(1.875rem, 1.3rem + 2.4vw, 2.75rem);
}

.how,
.sources,
.reach {
  padding-block: 48px;
}

@media (min-width: 960px) {
  .how,
  .sources,
  .reach {
    padding-block: 88px;
  }
}

/* How it works. The steps hang from the track like the numerals on a bezel scale. */

.how {
  padding-top: 0;
}

.how .track {
  margin-top: 20px;
}

.steps {
  display: grid;
  gap: 28px;
  margin: 0;
  padding: 24px 0 0;
  list-style: none;
}

.step h3 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: clamp(2rem, 1.6rem + 1.8vw, 2.75rem);
}

.step-number {
  color: var(--accent);
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums lining-nums;
}

.step p {
  max-width: 48ch;
  margin-top: 10px;
}

@media (min-width: 800px) {
  .how {
    --step-count: 3;
    --step-gap: 48px;
  }

  .how .track {
    /* Ten bold ticks span the distance from one step's leading edge to the next. */
    --major-tick-spacing: calc((100% + var(--step-gap)) / var(--step-count) / 10);
  }

  .steps {
    grid-template-columns: repeat(var(--step-count), minmax(0, 1fr));
    gap: var(--step-gap);
    padding-top: 0;
  }

  .step::before {
    content: "";
    display: block;
    width: 2px;
    height: 20px;
    margin-bottom: 18px;
    background: var(--muted);
  }
}

/* Where it looks */

.sources {
  display: grid;
  gap: 24px;
  padding-top: 0;
}

.sources-intro p {
  max-width: 44ch;
  margin-top: 14px;
}

.access {
  margin: 0;
}

.access > div {
  display: grid;
  gap: 6px;
  padding-block: 18px;
  border-top: 1px solid var(--border);
}

.access > div:last-child {
  border-bottom: 1px solid var(--border);
}

.access dt {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.access dt .tag {
  margin-right: -2px;
  transform: translateY(-2px);
}

.access dd {
  max-width: 56ch;
  margin: 0;
}

.sources-notes {
  display: grid;
  gap: 10px;
  max-width: 62ch;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 900px) {
  .sources {
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    grid-template-areas:
      "intro access"
      ".     notes";
    gap: 24px 64px;
    align-items: start;
  }

  .sources-intro {
    grid-area: intro;
  }

  .access {
    grid-area: access;
  }

  .sources-notes {
    grid-area: notes;
  }
}

/* Safety: always shown at night, with the four promises in lume. */

.safety {
  padding-block: 56px;
}

.promises {
  display: grid;
  margin: 28px 0 0;
  padding: 0;
  list-style: none;
}

.promises li {
  padding-block: 22px;
  border-top: 1px solid var(--border);
}

.promises h3 {
  color: var(--accent);
  font-size: 1.625rem;
  line-height: 1.15;
}

.promises p {
  max-width: 52ch;
  margin-top: 8px;
}

@media (min-width: 800px) {
  .safety {
    padding-block: 88px;
  }

  .promises {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 64px;
  }
}

/* Text or call */

.reach {
  display: grid;
  gap: 28px;
}

.reach-intro p {
  max-width: 48ch;
  margin-top: 14px;
}

.channels {
  margin: 24px 0 0;
}

.channels > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-block: 10px;
  border-top: 1px solid var(--border);
}

.channels > div:last-child {
  border-bottom: 1px solid var(--border);
}

.channels dt {
  font-weight: 500;
}

.channels dd {
  margin: 0;
  text-align: right;
}

.reach-form {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.reach-fields {
  display: grid;
  gap: 18px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.reach-fields:disabled {
  opacity: 0.55;
}

.reach-form .button {
  justify-self: start;
}

.reach-result {
  margin-top: 16px;
  font-weight: 600;
}

.reach-result[data-tone="ok"] {
  color: var(--ok);
}

@media (min-width: 900px) {
  .reach {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: 64px;
    align-items: start;
  }

  .reach-form {
    padding: 28px;
  }
}

/* Footer */

.footer {
  padding-bottom: 48px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.footer p {
  max-width: 70ch;
  margin-top: 20px;
}

/* Account entry and collector profile use the same panel as the conversation. */
.account-link {
  flex-shrink: 0;
  color: var(--accent);
  font-weight: 650;
}
.masthead-nav { margin-left: auto; }
.hero-join { margin-top: 20px; }
.hero-details { min-width: 0; }
.hero-first:has(.chat:not([data-view="chat"])) {
  height: auto;
  min-height: 0;
}
.chat:not([data-view="chat"]) {
  flex: none;
  align-self: start;
  width: 100%;
  height: auto;
  min-height: 0;
  max-height: none;
}
.chat:not([data-view="chat"]) .chat-head { padding: 20px; }
.chat:not([data-view="chat"]) .chat-title { font-size: 1.5rem; }
.invite,
.collector-workspace {
  display: grid;
  gap: 16px;
  padding: 20px;
}
.invite { border-top: 0; }
.invite .button,
.profile-controls .button { justify-self: start; }
.invite-note,
.invite-error { padding: 0; }
.local-mail,
.profile-summary { overflow-wrap: anywhere; }
.profile-summary h3 { margin: 18px 0 6px; font-size: 1.2rem; }
.profile-summary > :first-child { margin-top: 0; }
.profile-summary p + p { margin-top: 6px; }
.profile-summary ul { margin: 0; padding-left: 1.3rem; }
.profile-choices,
.profile-form { display: grid; gap: 12px; }
.profile-choices button {
  width: 100%;
  min-height: 46px;
  padding: 9px 14px;
  border: 1px solid var(--field-border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.profile-choices button:hover { background: var(--accent-wash); }
.profile-controls { display: flex; gap: 18px; align-items: center; }
.profile-form textarea { resize: vertical; }
.chat-foot { align-items: center; gap: 12px 16px; }
.chat-foot button { min-height: 36px; }
.broker-example { padding: 0 0 20px; max-width: 52ch; }
.broker-example p { margin: 0 0 8px; }
.example-label { color: var(--muted); font-size: .875rem; }
.example-ask { font-family: var(--font-display); font-size: 1.3rem; font-weight: 650; }
@media (min-width: 960px) {
  .hero-details { grid-area: spec; }
  .invite, .collector-workspace { padding: 24px; }
}

.messaging-start {
  display: grid;
  gap: 16px;
  padding: 20px;
}
.messaging-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.messaging-start > .button { justify-self: start; }
.messaging-start [data-messaging-fallback] { overflow-wrap: anywhere; }
.messaging-start details { margin-top: 10px; }
.messaging-start details > * + * { margin-top: 8px; }
.messaging-start summary { cursor: pointer; }
