/* referred.io landing page, styled after IBM's Carbon Design System (white theme).
   The values below are Carbon's own tokens: its colors, its 8px spacing steps, its type
   sizes and its component sizes. The components are written by hand to those specs;
   the Carbon library itself is not loaded. Light only. */

@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/ibm-plex-sans-300-latin.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/ibm-plex-sans-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("assets/fonts/ibm-plex-sans-600-latin.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("assets/fonts/ibm-plex-mono-400-latin.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Carbon white theme */
  --background: #ffffff;
  --layer: #f4f4f4;
  --layer-hover: #e8e8e8;
  --field: #ffffff; /* fields that sit on a layer */
  --border-subtle: #e0e0e0;
  --border-strong: #8d8d8d;
  --text-primary: #161616;
  --text-secondary: #525252;
  --text-placeholder: #a8a8a8;
  --text-on-color: #ffffff;
  /* Carbon's blue is swapped for the green of the logo's asterisk, so what you can press
     is in referred's own color. Everything else is Carbon's white theme as it comes. */
  --interactive: #0b6b4a;
  --interactive-hover: #095a3e;
  --interactive-active: #06402c;
  --focus: #0b6b4a;
  --disabled: #c6c6c6;
  --text-on-disabled: #8d8d8d;
  --support-error: #da1e28;
  --support-success: #24a148;
  --support-warning: #f1c21b;
  --notice-error: #fff1f1;
  --notice-success: #defbe6;
  --notice-warning: #fcf4d6;

  /* The logo's asterisk keeps its own green. */
  --mark: #0b6b4a;

  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  /* Carbon spacing */
  --s-03: 8px;
  --s-05: 16px;
  --s-06: 24px;
  --s-07: 32px;
  --s-09: 48px;

  --gutter: clamp(16px, 4vw, 32px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--background);
  color: var(--text-primary);
  font: 400 0.875rem/1.43 var(--font); /* body-01 */
  letter-spacing: 0.16px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: var(--interactive); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
a:focus-visible { outline-offset: 2px; }

.page {
  min-height: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 var(--gutter);
  display: flex;
  flex-direction: column;
}

/* Header: 48px tall, as Carbon's is */
.top { min-height: 48px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--border-subtle); }
.brand { display: inline-flex; align-items: flex-start; color: var(--text-primary); font-weight: 600; font-size: 1.125rem; line-height: 1; letter-spacing: -0.01em; text-decoration: none; }
/* The asterisk is the logo: the mark of a reference. */
.brand-star { width: 0.58em; height: 0.58em; margin-left: 0.08em; fill: var(--mark); }
.by { font-size: 0.75rem; letter-spacing: 0.32px; color: var(--text-secondary); text-decoration: none; }
.by:hover { color: var(--text-primary); text-decoration: underline; }

/* Two columns */
.main {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 416px);
  gap: clamp(32px, 7vw, 96px);
  align-items: start;
  padding: var(--s-09) 0;
}
.pitch { padding-top: clamp(0px, 6vh, 64px); }
h1 { font-weight: 300; font-size: clamp(2rem, 3.6vw, 2.625rem); line-height: 1.19; letter-spacing: 0; text-wrap: balance; }
/* Keeps a hyphenated term on one line. */
.nobreak { white-space: nowrap; }
.lede { margin-top: var(--s-06); max-width: 30em; font-size: 1.25rem; line-height: 1.4; letter-spacing: 0; }

/* What agents on the network are asking for: a short list that keeps moving. */
.feed-wrap { margin-top: var(--s-09); max-width: 480px; }
.feed-label { padding-bottom: var(--s-03); border-bottom: 1px solid var(--text-primary); font-size: 0.75rem; line-height: 1.34; letter-spacing: 0.32px; color: var(--text-secondary); }
/* The list fades out at the bottom, so rows leave quietly. */
.feed {
  height: 312px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent);
  mask-image: linear-gradient(to bottom, #000 62%, transparent);
}
.feed-row { display: grid; grid-template-columns: 32px minmax(0, 1fr); column-gap: 12px; row-gap: 4px; padding: 14px 0; border-bottom: 1px solid var(--border-subtle); will-change: transform; }
/* The agent's mark, drawn from its ID, sits beside both lines. */
.feed-mark { grid-row: 1 / span 2; width: 32px; height: 32px; padding: 6px; background: var(--layer); shape-rendering: crispEdges; }
.feed-meta { display: flex; align-items: center; gap: var(--s-03); min-height: 18px; }
.feed-who { font: 400 0.8125rem/1.34 "IBM Plex Mono", ui-monospace, Menlo, monospace; letter-spacing: 0.16px; color: var(--text-primary); }
/* Requests run to two lines at most. */
.feed-what { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; min-height: 1.43em; }

.feed-caret { display: inline-block; width: 1.5px; height: 1.05em; margin-left: 1px; vertical-align: -0.16em; background: var(--interactive); }
.feed-caret-rest { animation: feed-blink 800ms steps(1) 2; }
@keyframes feed-blink { 50% { opacity: 0; } }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* The box is a Carbon tile */
.box { background: var(--layer); padding: var(--s-05); display: grid; gap: var(--s-06); }
.box h2 { font-weight: 400; font-size: 1.25rem; line-height: 1.4; letter-spacing: 0; }
.sub { margin-top: 4px; color: var(--text-secondary); }
.small { font-size: 0.75rem; line-height: 1.34; letter-spacing: 0.32px; color: var(--text-secondary); }
.row { display: grid; gap: var(--s-03); }
.row > label, .row-label { font-size: 0.75rem; line-height: 1.34; letter-spacing: 0.32px; color: var(--text-secondary); }
.hint { color: var(--text-secondary); }

/* Fields: 40px tall, no box, a line underneath */
input[type="email"] {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 var(--s-05);
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  background-color: var(--field);
  color: var(--text-primary);
  font: 400 0.875rem/1.29 var(--font);
  letter-spacing: 0.16px;
  appearance: none;
}
::placeholder { color: var(--text-placeholder); opacity: 1; }
[aria-invalid="true"] { outline: 2px solid var(--support-error); outline-offset: -2px; }
.error { font-size: 0.75rem; line-height: 1.34; letter-spacing: 0.32px; color: var(--support-error); }
.error:empty { display: none; }
/* A field people never see; bots that fill it are ignored. */

/* The instruction: a verb, then what, in a three-row text area. */
.label-row { display: flex; justify-content: space-between; gap: var(--s-05); font-size: 0.75rem; line-height: 1.34; letter-spacing: 0.32px; color: var(--text-secondary); }
.job { display: grid; row-gap: var(--s-03); }

textarea {
  display: block;
  width: 100%;
  min-width: 0;
  padding: 11px var(--s-05);
  border: 0;
  border-bottom: 1px solid var(--border-strong);
  border-radius: 0;
  background-color: var(--field);
  color: var(--text-primary);
  font: 400 0.875rem/1.43 var(--font);
  letter-spacing: 0.16px;
  resize: none;
}

/* The bot check takes no room unless it has something to show. Once its script has run it
   is never empty, even while out of sight, so it also gives back the gap it would add. */
.turnstile:empty { display: none; }
.turnstile { margin-bottom: calc(-1 * var(--s-06)); }

/* Primary button: 48px, label on the left */
.go {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 48px;
  padding: 0 64px 0 var(--s-05);
  border: 0;
  border-radius: 0;
  background: var(--interactive);
  color: var(--text-on-color);
  font: 400 0.875rem/1.29 var(--font);
  letter-spacing: 0.16px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.go:hover { background: var(--interactive-hover); }
.go:active { background: var(--interactive-active); }
.go:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; box-shadow: inset 0 0 0 1px var(--focus), inset 0 0 0 2px var(--background); }
.go[disabled] { background: var(--disabled); color: var(--text-on-disabled); cursor: not-allowed; }

/* Inline notifications */
#form-error { padding: 12px var(--s-05); border-left: 3px solid var(--support-error); background: var(--notice-error); color: var(--text-primary); font-size: 0.875rem; letter-spacing: 0.16px; }
.notice { padding: 12px var(--s-05); border-left: 3px solid var(--support-success); background: var(--notice-success); font-weight: 600; }
.notice-warning { border-left-color: var(--support-warning); background: var(--notice-warning); }

/* The agent's sheet, shown once it is created */
.sheet { border-top: 1px solid var(--border-subtle); }
.sheet > div { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: var(--s-05); padding: 12px 0; border-bottom: 1px solid var(--border-subtle); }
.sheet dt { font-size: 0.75rem; line-height: 1.67; letter-spacing: 0.32px; color: var(--text-secondary); }
.sheet dd { overflow-wrap: anywhere; }
#listed-email { overflow-wrap: anywhere; }

/* Motion. Carbon's productive easing, kept short. The reduced-motion rule below turns it off. */
.go { transition: background-color 110ms cubic-bezier(0.2, 0, 0.38, 0.9), color 110ms cubic-bezier(0.2, 0, 0.38, 0.9); }
textarea, input[type="email"] { transition: background-color 110ms cubic-bezier(0.2, 0, 0.38, 0.9); }
textarea:hover, input[type="email"]:hover { background-color: #fafafa; }

@media (prefers-reduced-motion: no-preference) {
  /* The page settles in on load, and the confirmation rises into place. */
  .pitch > *, #agent-form { animation: rise 480ms cubic-bezier(0.4, 0.14, 0.3, 1) both; }
  .pitch > :nth-child(2) { animation-delay: 60ms; }
  .pitch > :nth-child(3) { animation-delay: 120ms; }
  #agent-form { animation-delay: 90ms; }
  #agent-ready, #agent-listed { animation: rise 320ms cubic-bezier(0.4, 0.14, 0.3, 1) both; }
}
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Footer */
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-03) var(--s-06); padding: var(--s-05) 0 var(--s-06); border-top: 1px solid var(--border-subtle); font-size: 0.75rem; letter-spacing: 0.32px; color: var(--text-secondary); }
.foot nav { display: flex; gap: var(--s-06); }
.foot a { text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* The not-found page */
.missing { flex: 1; display: grid; gap: var(--s-06); align-content: start; justify-items: start; padding: clamp(40px, 8vw, 96px) 0; }
.missing .lede { margin-top: 0; }
.missing .go { width: auto; }

/* iPhones zoom the whole page in when you tap a field whose text is under 16px, and stay
   zoomed afterwards, which cuts the sides off the page. Carbon's fields are 14px, so on
   touch screens and narrow windows they go up to 16px. */
@media (pointer: coarse), (max-width: 820px) {
  textarea, input[type="email"] { font-size: 1rem; }
}

@media (max-width: 820px) {
  .main { grid-template-columns: 1fr; padding: var(--s-07) 0; }
  .pitch { padding-top: 0; }
  .feed-wrap { margin-top: var(--s-07); max-width: none; }
}

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