/*
 * Recurring Work Items for Jira — the published documentation.
 *
 * The palette is lifted from docs/guides/marketplace-listing/index.html, which is the
 * Atlassian-flavoured one the owner's guides already use. Keeping them the same means a
 * reader moving between a guide and this site does not feel they have changed product.
 *
 * There is no build step here on purpose (see test/marketing/docs-site.test.ts): the file a
 * customer downloads is the file in the repo, so the drift test reads what actually ships.
 */

:root {
  --bg: #f7f8fc;
  --card: #ffffff;
  --ink: #172b4d;
  --muted: #6b778c;
  --blue: #0052cc;
  --amber: #d97008;
  --line: #dfe3ec;
  --chip: #eef2fb;
  --warn: #fff4e5;
  --ok: #216e4e;
  --okbg: #e6f5ec;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141924;
    --card: #1c2331;
    --ink: #e6ecf5;
    --muted: #97a3b8;
    --blue: #6aa4ff;
    --amber: #f0a35e;
    --line: #2b3547;
    --chip: #212b3d;
    --warn: #33291a;
    --ok: #7ee2b8;
    --okbg: #17352a;
  }
}

:root { color-scheme: light dark; }
* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---- the shared chrome ------------------------------------------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}

.site-nav .inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 11px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 18px;
}

.site-nav .brand {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  margin-right: auto;
  white-space: nowrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.92rem;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--blue);
}

.site-nav a[aria-current="page"] { font-weight: 600; }

.wrap {
  max-width: 880px;
  margin: 0 auto;
  padding: 26px 20px 80px;
}

.site-foot {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.86rem;
}

.site-foot .inner {
  max-width: 880px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--blue); }
.site-foot .spacer { margin-left: auto; }

/* ---- prose -------------------------------------------------------------- */

h1 {
  font-size: 1.8rem;
  line-height: 1.25;
  margin: 12px 0 6px;
  color: var(--blue);
}

h2 {
  font-size: 1.18rem;
  margin: 38px 0 0;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--line);
  color: var(--amber);
  scroll-margin-top: 64px;
}

h3 {
  font-size: 1rem;
  margin: 24px 0 0;
  scroll-margin-top: 64px;
}

p { margin: 10px 0; }

p.lede {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0 0 4px;
}

a { color: var(--blue); }

ul, ol { padding-left: 22px; }
li { margin: 6px 0; }

b, strong { font-weight: 600; }

code {
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 6px;
  font: 0.85em ui-monospace, "SF Mono", Menlo, monospace;
  white-space: nowrap;
}

pre {
  background: var(--chip);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  overflow-x: auto;
  font: 0.85rem/1.55 ui-monospace, "SF Mono", Menlo, monospace;
}

pre code {
  background: none;
  border: 0;
  padding: 0;
  white-space: pre;
}

/* Values quoted from the app: a limit the code enforces, or an option label the UI shows.
   Both are pinned by test/marketing/docs-site.test.ts, and both read as quotations. */
[data-fact] { font-weight: 600; }

/* A tagged value that is a whole SENTENCE the app prints, not a number. Bolding one of those
   makes a paragraph read as a heading, so it is set as a quotation instead. */
[data-fact].said {
  font-weight: 400;
  font-style: italic;
  color: var(--muted);
}

[data-option] {
  font-weight: 600;
  color: var(--ink);
}

/* ---- tables ------------------------------------------------------------- */

.scroll-x {
  overflow-x: auto;
  margin: 12px 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
}

th, td {
  border: 1px solid var(--line);
  padding: 7px 10px;
  text-align: left;
  vertical-align: top;
}

th { background: var(--chip); }
td code { white-space: nowrap; }

/* ---- callouts ----------------------------------------------------------- */

.note,
.caution {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin: 16px 0;
  font-size: 0.95rem;
}

.note {
  background: var(--okbg);
  border-left: 4px solid var(--ok);
}

.caution {
  background: var(--warn);
  border-left: 4px solid var(--amber);
}

.note > :first-child,
.caution > :first-child { margin-top: 0; }

.note > :last-child,
.caution > :last-child { margin-bottom: 0; }

/* ---- figures ------------------------------------------------------------ */

figure {
  margin: 20px 0;
}

figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

figcaption {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 7px;
}

/* ---- the overview page's card grid -------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.cards li { margin: 0; }

.cards a {
  display: block;
  height: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  text-decoration: none;
  color: var(--ink);
}

.cards a:hover { border-color: var(--blue); }
.cards a b { color: var(--blue); display: block; margin-bottom: 3px; }
.cards a span { color: var(--muted); font-size: 0.9rem; }

/* ---- option lists ------------------------------------------------------- */

/* The label is its own element so the drift test can lift it whole; the prose explaining it
   sits outside, which is also how it should read. */
ul.options {
  list-style: none;
  padding-left: 0;
}

ul.options > li {
  border-left: 3px solid var(--line);
  padding-left: 12px;
  margin: 12px 0;
}

ul.options > li > [data-option] { display: block; }

/* ---- 404 ---------------------------------------------------------------- */

.centred {
  text-align: center;
  padding: 60px 0 40px;
}

/* ---- the documentation assistant ---------------------------------------- */

/*
 * The panel `site/chat.js` builds on every page. It is styled here rather than in the script
 * for the same reason the pages are hand-written: the stylesheet is the file that ships, and
 * a reader with JavaScript off gets a site with no chat rather than a site with a broken one.
 */

.chat-launcher {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--blue);
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  font: 600 0.92rem/1 system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 12px 18px 12px 14px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgb(23 43 77 / 28%);
}

.chat-launcher:hover { filter: brightness(1.07); }

.chat-launcher-mark {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgb(255 255 255 / 22%);
  font-size: 0.8rem;
  font-weight: 700;
}

.chat-panel {
  position: fixed;
  right: 18px;
  bottom: 76px;
  z-index: 21;
  display: flex;
  flex-direction: column;
  width: min(390px, calc(100vw - 36px));
  max-height: min(72vh, 580px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 14px 44px rgb(23 43 77 / 26%);
  overflow: hidden;
}

.chat-panel[hidden] { display: none; }

.chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--chip);
}

.chat-head b { margin-right: auto; }

.chat-close {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}

.chat-close:hover { color: var(--ink); }

.chat-log {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  font-size: 0.93rem;
}

.chat-empty p { margin-top: 0; color: var(--muted); }

.chat-suggests {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.chat-suggest {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--blue);
  font: inherit;
  font-size: 0.88rem;
  text-align: left;
  padding: 7px 13px;
  cursor: pointer;
}

.chat-suggest:hover { border-color: var(--blue); }

.chat-turn { margin: 0 0 14px; }
.chat-turn > :first-child { margin-top: 0; }
.chat-turn > :last-child { margin-bottom: 0; }

.chat-user {
  margin-left: auto;
  width: fit-content;
  max-width: 88%;
  background: var(--chip);
  border: 1px solid var(--line);
  border-radius: 12px 12px 3px 12px;
  padding: 8px 11px;
}

.chat-assistant ul { padding-left: 20px; }
.chat-assistant li { margin: 3px 0; }
.chat-failed { color: var(--amber); }

/* The answer is being written. A caret says "still coming" without a spinner that would have
   to be removed on four different code paths. */
.chat-caret {
  display: inline-block;
  width: 7px;
  height: 1em;
  vertical-align: text-bottom;
  background: var(--blue);
  animation: chat-blink 1s steps(2, start) infinite;
}

@keyframes chat-blink { to { visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  .chat-caret { animation: none; opacity: 0.6; }
}

.chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--line);
}

.chat-compose textarea {
  flex: 1;
  resize: none;
  max-height: 140px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.93rem;
  padding: 9px 10px;
}

.chat-compose textarea:focus {
  outline: 2px solid var(--blue);
  outline-offset: -1px;
}

.chat-send {
  border: 1px solid var(--blue);
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font: 600 0.9rem/1 inherit;
  padding: 10px 14px;
  cursor: pointer;
}

.chat-send:disabled {
  opacity: 0.55;
  cursor: default;
}

.chat-foot {
  margin: 0;
  padding: 0 14px 12px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

@media (max-width: 480px) {
  .chat-panel {
    right: 10px;
    left: 10px;
    bottom: 70px;
    width: auto;
    max-height: 76vh;
  }

  .chat-launcher { right: 10px; bottom: 10px; }
}
