/* AgentBrief for AI assistants: /ai, /ai/prompts, /ai/prompts/:slug.
   Self-contained (no common.css). Grotesk for the interface, serif only for
   prompt text: the words you say to your assistant. */

:root {
  --ink: #0e2244;          /* AgentBrief navy */
  --ink-2: #16305a;
  --paper: #f3f5f8;
  --surface: #ffffff;
  --text: #273042;
  --muted: #647089;
  --line: #dde2ea;
  --blue: #1f90cc;         /* AgentBrief app blue */
  --blue-deep: #1677ad;
  --field: #e3f0f8;
  --on-ink: #eef3fa;
  --on-ink-muted: #a9b8d0;

  --sans: 'Schibsted Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;

  --measure: 68ch;
  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0b1730;
    --surface: #102143;
    --text: #e3e9f3;
    --muted: #9aa8c1;
    --line: #22355c;
    --blue: #4fb0e6;
    --blue-deep: #2b93cf;
    --field: #15385c;
  }
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--blue-deep);
  text-underline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-s);
  z-index: 20;
}

.skip-link:focus {
  top: 12px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
}

.section-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Top bar: always on navy, so every page opens on the brand. */
.topbar {
  background: var(--ink);
  color: var(--on-ink);
}

.topbar-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  display: block;
  height: 40px;
  filter: brightness(0) invert(1);
}

.early-access-tag {
  padding: 4px 11px;
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.early-access-note {
  margin-top: 22px;
  font-size: 0.92rem;
  color: var(--on-ink-muted);
}

.early-access-note a {
  color: #fff;
}

.topnav {
  display: flex;
  gap: 28px;
  font-size: 0.95rem;
  font-weight: 500;
}

.topnav a {
  color: var(--on-ink-muted);
  text-decoration: none;
  white-space: nowrap;
}

.topnav a:hover,
.topnav a[aria-current="page"] {
  color: #fff;
}

.topnav a[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

/* Buttons */
.button {
  display: inline-flex;
  align-items: center;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  border-radius: var(--radius-m);
  padding: 13px 22px;
  border: 1px solid transparent;
  cursor: pointer;
}

.button-light {
  background: #fff;
  color: var(--ink);
}

.button-light:hover {
  background: var(--field);
}

.button-ghost {
  color: var(--on-ink);
  border-color: rgba(238, 243, 250, 0.35);
}

.button-ghost:hover {
  border-color: var(--on-ink);
}

.action {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 7px 13px;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.action:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
}

.action-primary {
  background: var(--blue-deep);
  border-color: var(--blue-deep);
  color: #fff;
}

.action-primary:hover {
  background: var(--ink-2);
  border-color: var(--ink-2);
  color: #fff;
}

.text-link {
  font-weight: 600;
  text-decoration: none;
}

.text-link:hover {
  text-decoration: underline;
}

/* Hero: the question and the answer it gets. */
.hero {
  background: var(--ink);
  color: var(--on-ink);
  overflow: hidden;
}

.hero-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 56px 24px 0;
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 56px;
  align-items: end;
}

.hero-copy {
  padding-bottom: 72px;
}

.hero h1 {
  font-size: clamp(2.3rem, 4.6vw, 3.6rem);
  line-height: 1.04;
  letter-spacing: -0.035em;
  font-weight: 700;
  color: #fff;
  max-width: 15ch;
}

.hero-lede {
  margin-top: 22px;
  font-size: 1.13rem;
  line-height: 1.6;
  color: var(--on-ink-muted);
  max-width: 44ch;
}

.hero-actions {
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* The assistant window sits on the hero's bottom edge, as if on the desk. */
.chat {
  background: #fbfcfd;
  color: #273042;
  border-radius: var(--radius-l) var(--radius-l) 0 0;
  box-shadow: 0 -24px 80px rgba(3, 12, 32, 0.45);
}

.chat-bar {
  display: flex;
  gap: 7px;
  padding: 14px 18px;
  border-bottom: 1px solid #e6eaf0;
}

.chat-bar span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #d6dbe3;
}

.chat-body {
  padding: 26px 28px 32px;
  display: grid;
  gap: 20px;
}

.chat-ask {
  justify-self: end;
  max-width: 88%;
  font-family: var(--serif);
  font-size: 1.12rem;
  line-height: 1.5;
  background: #eef2f7;
  border-radius: 14px 14px 4px 14px;
  padding: 12px 16px;
  min-height: 3.2em;
}

.chat-answer {
  display: grid;
  gap: 14px;
  font-size: 0.97rem;
}

.chat-tools {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chat-tool {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #1a5f88;
  background: #e3f0f8;
  border-radius: 999px;
  padding: 5px 12px 5px 9px;
}

.chat-tool::before {
  content: '';
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1f90cc url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpath d='M3.5 7.2 6 9.6l4.6-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat;
}

.chat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.93rem;
  font-variant-numeric: tabular-nums;
}

.chat-table th {
  text-align: left;
  font-size: 0.8rem;
  font-weight: 600;
  color: #647089;
  padding: 0 10px 8px 0;
  border-bottom: 1px solid #e1e6ed;
}

.chat-table td {
  padding: 9px 10px 9px 0;
  border-bottom: 1px solid #edf0f4;
}

.chat-table tr:last-child td {
  border-bottom: 0;
}

.chat-table td:first-child {
  font-weight: 600;
  color: #0e2244;
}

.chat-table .num {
  text-align: right;
}

/* One orchestrated moment: the question types in, then the answer arrives. */
.is-animating .chat-answer > * {
  opacity: 0;
  transform: translateY(6px);
}

.is-animating .chat-answer > .is-shown {
  opacity: 1;
  transform: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.is-animating .chat-ask::after {
  content: '';
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 2px;
  vertical-align: -0.15em;
  background: #273042;
  animation: caret 0.9s steps(1) infinite;
}

.is-typed .chat-ask::after {
  display: none;
}

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

/* Connect */
.connect {
  padding: 88px 0;
}

.connect-inner {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: 56px;
  align-items: start;
}

h2 {
  font-size: clamp(1.6rem, 2.6vw, 2rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 700;
  color: var(--text);
}

.connect-intro p {
  margin-top: 14px;
  color: var(--muted);
  max-width: 46ch;
}

.field-label {
  display: block;
  margin-top: 28px;
  font-size: 0.9rem;
  font-weight: 600;
}

.url-field {
  margin-top: 8px;
  display: flex;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 6px 6px 6px 14px;
}

.url-field input {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.95rem;
  color: var(--text);
  background: transparent;
  border: 0;
}

.url-field input:focus {
  outline: none;
}

.url-field:focus-within {
  border-color: var(--blue);
}

.fine-print {
  font-size: 0.88rem;
}

.connect-guide {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 28px 32px 32px;
}

.segmented {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  background: var(--paper);
  border-radius: var(--radius-m);
  padding: 4px;
}

.segmented button {
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 8px 16px;
  cursor: pointer;
}

.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(14, 34, 68, 0.12);
}

.steps {
  list-style: none;
  counter-reset: step;
  margin-top: 26px;
  display: grid;
  gap: 18px;
}

.steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 46px;
  min-height: 30px;
}

.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -2px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--field);
  border-radius: 50%;
}

@media (prefers-color-scheme: dark) {
  .steps > li::before {
    color: #fff;
  }
}

.command {
  display: block;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-m);
  background: var(--ink);
  color: var(--on-ink);
  word-break: break-all;
  cursor: copy;
}

/* Prompts */
.asks {
  padding: 8px 0 96px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.section-sub,
.group-sub {
  margin-top: 10px;
  color: var(--muted);
  max-width: var(--measure);
}

.prompt-list {
  margin-top: 28px;
  display: grid;
  gap: 0 56px;
}

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

.prompt {
  padding: 26px 0 30px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 12px;
  align-content: start;
}

.prompt-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.prompt-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.prompt-title a {
  color: var(--muted);
  text-decoration: none;
}

.prompt-title a:hover {
  color: var(--blue-deep);
  text-decoration: underline;
}

.prompt-needs {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
}

/* The words you say: serif, set like a quotation. */
.prompt-says {
  font-family: var(--serif);
  font-size: 1.32rem;
  line-height: 1.5;
  letter-spacing: -0.005em;
  color: var(--text);
  max-width: 60ch;
}

.prompt-says-large {
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  line-height: 1.45;
}

/* Swappable values look like a filled-in field on a form. */
.blank {
  color: var(--blue-deep);
  background: var(--field);
  border-bottom: 2px dotted var(--blue);
  border-radius: 3px 3px 0 0;
  padding: 0 3px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.prompt-gets {
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 60ch;
}

.prompt-actions {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Page head (library and detail) */
.page-head {
  background: var(--ink);
  color: var(--on-ink);
  padding: 44px 0 56px;
}

.page-head h1 {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.06;
  letter-spacing: -0.035em;
  font-weight: 700;
  color: #fff;
  max-width: 20ch;
}

.page-lede {
  margin-top: 16px;
  font-size: 1.1rem;
  color: var(--on-ink-muted);
  max-width: var(--measure);
}

.page-lede a {
  color: #fff;
}

/* Library */
.library {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 64px;
  padding-top: 48px;
  padding-bottom: 96px;
}

.library-index {
  position: sticky;
  top: 24px;
  align-self: start;
}

.search input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 10px 14px;
}

.search input:focus {
  outline: none;
  border-color: var(--blue);
}

.filters {
  list-style: none;
  margin-top: 18px;
  display: grid;
  gap: 2px;
}

.filters button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: var(--radius-s);
  padding: 8px 10px;
  cursor: pointer;
}

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

/* The active filter is just the strongest line in the list; its count turns into a solid pill. */
.filters button[aria-selected="true"] {
  color: var(--text);
  font-weight: 600;
}

.count {
  min-width: 26px;
  text-align: center;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  border-radius: 999px;
  padding: 1px 8px;
}

.filters button[aria-selected="true"] .count {
  color: #fff;
  background: var(--ink);
}

@media (prefers-color-scheme: dark) {
  .filters button[aria-selected="true"] .count {
    color: var(--ink);
    background: var(--blue);
  }
}

.group + .group {
  margin-top: 56px;
}

.library-empty {
  color: var(--muted);
  padding: 40px 0;
}

/* Detail */
.back-link {
  display: inline-block;
  margin-bottom: 18px;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--on-ink-muted);
  text-decoration: none;
}

.back-link:hover {
  color: #fff;
}

.back-link::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}

.detail {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
  gap: 72px;
  padding-top: 52px;
  padding-bottom: 72px;
}

.detail-main .prompt-actions {
  margin-top: 22px;
}

.detail h2 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  margin-top: 44px;
}

.detail-side h2:first-child {
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

/* Your details: fill in once, every prompt uses it. */
.your-details {
  margin-bottom: 48px;
  padding: 20px 22px 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
}

.your-details-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
}

.your-details h2 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.your-details-head .muted {
  font-size: 0.88rem;
}

.your-details-fields {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
}

.detail-field {
  flex: 1 1 160px;
  display: grid;
  gap: 5px;
}

.detail-field-zip {
  flex: 1 1 100px;
}

.detail-field-nmls {
  flex: 1 1 120px;
}

.detail-field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.detail-field input {
  width: 100%;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 11px;
}

.detail-field input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.detail-field input:focus {
  outline: none;
  border-color: var(--blue);
  background: var(--surface);
}

.link-button {
  margin-top: 14px;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--blue-deep);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.link-button:hover {
  text-decoration: underline;
}

/* Blanks are editable in place; one you've filled in turns solid. */
.blank[contenteditable] {
  cursor: text;
}

.blank[contenteditable]:hover {
  border-bottom-style: solid;
}

.blank[contenteditable]:focus {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
  border-radius: 3px;
}

.blank.is-filled {
  color: var(--text);
  border-bottom-style: solid;
}

.steps-tight {
  margin-top: 18px;
  gap: 16px;
}

.steps-tight > li {
  display: grid;
  gap: 2px;
}

.needs {
  margin-top: 14px;
  padding-left: 18px;
  display: grid;
  gap: 8px;
}

.asks-related {
  border-top: 1px solid var(--line);
  padding-top: 56px;
}

/* Footer and toast */
.site-footer {
  border-top: 1px solid var(--line);
}

.site-footer-inner {
  max-width: 1160px;
  margin: 0 auto;
  padding: 28px 24px 40px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 0.9rem;
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  opacity: 0;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  border-radius: var(--radius-m);
  padding: 11px 18px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Smaller screens */
@media (max-width: 960px) {
  .hero-inner,
  .connect-inner,
  .detail {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .hero-copy {
    padding-bottom: 0;
  }

  .hero h1 {
    max-width: 16ch;
  }

  .library {
    grid-template-columns: minmax(0, 1fr);
    gap: 28px;
  }

  .library-index {
    position: static;
  }

  .filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .filters button {
    width: auto;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 14px;
  }

  .filters button[aria-selected="true"] {
    color: #fff;
    background: var(--ink);
    border-color: var(--ink);
  }

  .filters button[aria-selected="true"] .count {
    color: var(--on-ink-muted);
    background: transparent;
  }
}

@media (max-width: 720px) {
  .section-inner,
  .topbar-inner,
  .hero-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .topnav {
    gap: 18px;
  }

  .topnav-secondary {
    display: none;
  }

  .brand-group {
    gap: 10px;
  }

  .brand-logo {
    height: 32px;
  }

  .early-access-tag {
    padding: 3px 9px;
    font-size: 0.75rem;
  }

  .hero-inner {
    padding-top: 36px;
  }

  .chat-body {
    padding: 20px 16px 24px;
  }

  .chat-table th:nth-child(2),
  .chat-table td:nth-child(2) {
    display: none;
  }

  .connect {
    padding: 56px 0;
  }

  .connect-guide {
    padding: 22px 18px 24px;
  }

  .prompt-list-two {
    grid-template-columns: minmax(0, 1fr);
  }

  .prompt-says {
    font-size: 1.2rem;
  }
}
