/* Layout and typography for the public pages and the gateway-rendered pages,
 * in the ggautomata Instrument style, drawn as The Patch.
 *
 * The Patch: every page Ingest reads is shown as a unified diff. Furniture is
 * the minus (dim, struck), content is the plus (full ink). The site keeps
 * that world everywhere: a ch-cell gutter, reversed hunk-header plates, one
 * type size in data regions, rank by weight, case and reversal, and one amber
 * signal for actions and live numbers. No red, no green. DESIGN.md has the
 * full system.
 *
 * Tokens only: every color and size below is a var(--...) from the pinned
 * brand export in /assets/brand/ (tokens.css, fonts/fonts.css). This file holds
 * no literal color. Light and dark follow the system setting. */

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

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: var(--color-border-control) var(--color-bg);
  scroll-padding-top: var(--space-6);
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  font-weight: var(--weight-regular);
  caret-color: var(--color-signal);
  accent-color: var(--color-signal);
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--color-signal);
  color: var(--color-on-signal);
}

.page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.shell {
  width: 100%;
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.shell-wide {
  max-width: calc(var(--page-wide) + 2 * var(--gutter));
}

.shell-account {
  max-width: calc(64rem + 2 * var(--gutter));
}

/* Header: the wordmark, then the pages as file tabs on the header's rule. --- */

.site-header {
  border-bottom: var(--border-width) solid var(--color-border);
}

.site-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  padding-top: var(--space-4);
}

.site-header-row .wordmark {
  padding-bottom: var(--space-3);
}

.wordmark {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-wordmark);
  line-height: 1;
}

.wordmark a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
  text-decoration: none;
}

.wordmark svg {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--color-signal-text);
}

.site-header .site-nav {
  display: flex;
  flex-wrap: wrap;
  margin-bottom: calc(-1 * var(--border-width));
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.site-header .site-nav a {
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid transparent;
  border-bottom: 0;
  color: var(--color-text-muted);
  text-decoration: none;
}

.site-header .site-nav a:hover,
.site-header .site-nav a:focus-visible {
  color: var(--color-text);
  border-color: var(--color-border);
}

.site-header .site-nav a[aria-current="page"] {
  border-color: var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: var(--weight-medium);
}

/* Footer: the last line of the patch. --------------------------------------- */

.site-footer {
  margin-top: auto;
  border-top: var(--border-width) solid var(--color-border);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.site-footer-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  padding-block: var(--space-5);
}

.site-footer-row p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

.site-footer-row p::before {
  content: "\\ ";
  color: var(--color-text-faint);
}

.site-footer .site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
}

.site-footer .site-nav a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.site-footer .site-nav a:hover,
.site-footer .site-nav a:focus-visible {
  color: var(--color-text);
  text-decoration: underline;
}

/* Type -------------------------------------------------------------------- */

.site-main {
  flex: 1;
  padding-block: var(--space-7) var(--space-8);
}

h1,
h2,
h3 {
  font-weight: var(--weight-medium);
  line-height: var(--leading-heading);
  text-wrap: balance;
}

h1 {
  margin: 0 0 var(--space-5);
  font-size: var(--text-3xl);
  letter-spacing: var(--tracking-display);
  line-height: var(--leading-tight);
}

/* A section heading is a hunk header: a plate with "@@" in its gutter cell.
   The inset is in rem, not ch: a ch here would measure the heading's own
   large face and push the text away from the "@@". The "@@" sits where a
   box's padding starts, so it lines up with the labels in a box below. */
h2 {
  position: relative;
  margin: var(--space-8) 0 var(--space-4);
  padding: var(--space-2) var(--space-3) var(--space-2) calc(var(--space-4) + var(--space-6));
  border-block: var(--border-width) solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-xl);
  letter-spacing: var(--tracking-wordmark);
}

h2::before {
  content: "@@";
  position: absolute;
  left: var(--space-4);
  top: 50%;
  translate: 0 -50%;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  color: var(--color-text-faint);
}

h3 {
  margin: var(--space-6) 0 var(--space-2);
  font-size: var(--text-base);
}

p,
ul,
ol {
  margin: 0 0 var(--space-4);
  max-width: var(--measure);
  text-wrap: pretty;
}

li + li {
  margin-top: var(--space-1);
}

.lede {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
}

/* A short monospace name for a value. Sentence case, no tracking. */
.label {
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.label-signal {
  color: var(--color-signal-text);
}

a {
  color: var(--color-link);
  text-underline-offset: 0.2em;
  text-decoration-thickness: var(--border-width);
}

a:hover,
a:focus-visible {
  color: var(--color-link-hover);
}

:focus-visible {
  outline: var(--outline-width) solid var(--color-focus);
  outline-offset: var(--space-1);
}

/* Code -------------------------------------------------------------------- */

code {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  overflow-wrap: break-word;
}

p code,
li code,
td code,
dd code {
  padding: 0 var(--space-1);
  background: var(--color-code-bg);
  color: var(--color-code-text);
}

pre {
  margin: 0 0 var(--space-4);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-code-bg);
  color: var(--color-code-text);
}

pre code {
  font-size: var(--text-sm);
  white-space: pre;
  background: none;
  color: inherit;
  padding: 0;
}

/* Reading pages: a line-number gutter down the left, one number per block.
   The numbers are the patch's own furniture, set faint and never selected. */
.doc {
  counter-reset: line;
}

.doc > :where(h1, h2, h3, p, ul, ol, dl, table, .disclosure) {
  position: relative;
  counter-increment: line;
}

.doc > :where(h1, h3, p, ul, ol, dl, table, .disclosure)::before {
  content: counter(line);
  position: absolute;
  right: calc(100% + var(--cell-mark));
  top: 0.35em;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-regular);
  line-height: 1.6;
  letter-spacing: 0;
  color: var(--color-text-faint);
  user-select: none;
}

.doc > h1::before {
  top: 0.9em;
}

.doc > h2 {
  margin-left: calc(-1 * var(--space-8));
  padding-left: var(--space-8);
}

/* The line number and "@@" fill the plate's gutter; the heading text starts
   on the body column. */
.doc > h2::before {
  content: counter(line) "\00a0\00a0@@";
  left: 0;
  width: calc(var(--space-8) - var(--space-3));
  text-align: right;
}

/* The History disclosure, matching the consent page: a comment line. */
.disclosure {
  padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* The OAuth consent page: a reading column and its two choices. */
.consent {
  max-width: calc(var(--measure) + 2 * var(--gutter));
}

.consent code {
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
  margin: var(--space-6) 0 0;
}

.fine {
  margin-top: var(--space-4);
  color: var(--color-text-faint);
  font-size: var(--text-sm);
}

/* Buttons: square, weight not size. The primary is the one amber fill. ---- */

.button {
  display: inline-block;
  font: inherit;
  font-weight: var(--weight-medium);
  line-height: var(--leading-heading);
  padding: var(--space-3) var(--space-5);
  border: var(--border-width) solid var(--color-border-control);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--duration-state) var(--ease-state),
    border-color var(--duration-state) var(--ease-state),
    color var(--duration-state) var(--ease-state);
}

.button:hover,
.button:focus-visible {
  border-color: var(--color-text);
  color: var(--color-text);
}

.button:active {
  background: var(--color-surface);
}

.button:disabled,
.button[aria-disabled="true"] {
  border-color: var(--color-border);
  color: var(--color-text-faint);
  cursor: not-allowed;
}

.button-primary {
  border-color: var(--color-signal);
  background: var(--color-signal);
  color: var(--color-on-signal);
}

.button-primary:hover,
.button-primary:focus-visible {
  border-color: var(--color-text);
  background: var(--color-signal);
  color: var(--color-on-signal);
}

.button-primary:active {
  background: var(--color-signal);
  border-color: var(--color-on-signal);
}

/* Irreversible actions: deleting the Account, revoking a client. The patch has
   no red; an irreversible button is a minus line, and it reverses on hover. */
.deletion .button,
.deletion-confirm .button,
.revoke-confirm .button {
  border-color: var(--color-text);
  color: var(--color-text);
}

.deletion .button::before,
.deletion-confirm .button::before,
.revoke-confirm .button::before {
  content: "- ";
  font-family: var(--font-mono);
}

.deletion .button:hover,
.deletion-confirm .button:hover,
.revoke-confirm .button:hover,
.deletion .button:focus-visible,
.deletion-confirm .button:focus-visible,
.revoke-confirm .button:focus-visible {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-bg);
}

/* The landing page -------------------------------------------------------- */

.patch {
  padding-block: var(--space-7) var(--space-8);
  border-bottom: var(--border-width) solid var(--color-border);
}

.patch-body {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: var(--space-7);
  align-items: start;
}

/* The hunk header as the page's headline number: reversed, in the cell grid. */
.hunk {
  display: inline-block;
  margin: 0 0 var(--space-5);
  padding: var(--space-1) var(--cell-1);
  background: var(--color-plate-bg);
  color: var(--color-plate-text);
  font-family: var(--font-mono);
  font-size: clamp(1.25rem, 0.8rem + 1.6vw, 2.125rem);
  font-weight: var(--weight-medium);
  line-height: 1.2;
  letter-spacing: 0;
  white-space: nowrap;
}

.patch h1 {
  max-width: 16ch;
  font-size: var(--text-display);
}

.patch .lede {
  max-width: 34rem;
}

.endpoint {
  margin: var(--space-6) 0 0;
  max-width: 34rem;
}

.endpoint .label {
  margin: 0 0 var(--space-2);
}

/* No script on this page, so the copy control is the browser's own: one click
   selects the whole URL. */
.endpoint code {
  display: block;
  padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid var(--color-border-control);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--text-base);
  overflow-wrap: anywhere;
  user-select: all;
  cursor: text;
}

.endpoint code:hover {
  border-color: var(--color-text);
}

.endpoint .fine {
  margin: var(--space-2) 0 0;
}

/* The compare window. The same page twice, side by side: its HTML left of the
   divider, Ingest's Markdown right of it. --split is the HTML's share of the
   width; each side lays out in its own column, so the Markdown always starts
   at the divider and wraps. Without the script the divider rests at the
   middle. */
@property --split {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 50%;
}

.compare {
  margin: 0;
  min-width: 0;
  border: var(--border-width) solid var(--color-border);
  background: var(--color-code-bg);
}

.compare-files {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-bottom: var(--border-width) solid var(--color-border);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.7;
  color: var(--color-text-muted);
}

.compare-files span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-files span:last-child {
  flex-shrink: 0;
  color: var(--color-text);
}

.compare-view {
  --split: 50%;
  position: relative;
  display: grid;
  grid-template-columns: var(--split) minmax(0, 1fr);
  height: clamp(22rem, 60vh, 32rem);
  overflow: hidden;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
}

.compare-pane {
  min-width: 0;
  margin: 0;
  padding: var(--space-2) 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
}

.compare-pane code {
  display: block;
  font-size: var(--text-xs);
  line-height: 1.7;
  overflow-wrap: normal;
}

.compare-html {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

.compare-md {
  background: var(--color-surface);
  color: var(--color-text);
  padding-left: var(--space-2);
  overflow-y: auto;
  scrollbar-width: thin;
}

.compare .l {
  display: grid;
  grid-template-columns: var(--cell-number) minmax(0, 1fr);
  padding-right: var(--space-3);
}

.compare .l > i {
  font-style: normal;
  color: var(--color-text-faint);
  text-align: right;
  padding-right: var(--cell-mark);
}

.compare-html .l > span {
  overflow: hidden;
  white-space: pre;
}

.compare-md .l > span {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.compare-md .front > span,
.compare-md u {
  color: var(--color-text-faint);
  text-decoration: none;
}

.compare-md .h b {
  font-weight: var(--weight-medium);
  color: var(--color-signal-text);
}

.compare-md strong {
  font-weight: var(--weight-medium);
}

.compare-md .fold > span {
  color: var(--color-text-faint);
}

.compare-md .fold > span::before {
  content: "⋯ ";
}

.compare-divider {
  position: absolute;
  inset-block: 0;
  left: var(--split);
  border-left: var(--border-width-strong) solid var(--color-signal);
  translate: -50% 0;
  pointer-events: none;
}

.compare-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  translate: -50% -50%;
  border-radius: var(--radius-sm);
  background: var(--color-signal);
  color: var(--color-on-signal);
}

.compare-handle svg {
  width: 1rem;
  height: 1rem;
}

/* The range input is the keyboard and assistive-technology control. It stays
   in the page, invisibly, and the handle shows its focus. */
.compare-range {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.compare-view:has(.compare-range:focus-visible) .compare-handle {
  outline: var(--outline-width) solid var(--color-focus);
  outline-offset: var(--space-1);
}

.compare figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  padding: var(--space-3);
  border-top: var(--border-width) solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.compare figcaption p {
  margin: 0;
  max-width: none;
}

.num {
  font-family: var(--font-mono);
  font-size: var(--text-mono);
  color: var(--color-signal-text);
}

/* The one authored motion: on load the divider sweeps in from the right,
   uncovering the Markdown, and settles at the middle. A drag stops it. */
@media (prefers-reduced-motion: no-preference) {
  .compare-view {
    animation: compare-intro 900ms var(--delay-strike) var(--ease-strike) backwards;
  }

  .compare-view.is-moved {
    animation: none;
  }
}

@keyframes compare-intro {
  from {
    --split: 92%;
  }
}

/* Sections below the patch. */
.section {
  padding-block: var(--space-8);
  border-bottom: var(--border-width) solid var(--color-border);
}

.section:last-child {
  border-bottom: 0;
}

.section h2 {
  margin-top: 0;
}

.section-intro {
  max-width: var(--measure);
}

/* A timetable: the thing you type or see, beside what it does. */
.rows {
  margin: var(--space-6) 0 0;
  padding: 0;
  max-width: none;
  list-style: none;
  border-top: var(--border-width) solid var(--color-border);
}

.rows > li {
  display: grid;
  grid-template-columns: var(--cell-mark) minmax(0, 22rem) minmax(0, 1fr);
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding: var(--space-4) 0;
  border-bottom: var(--border-width) solid var(--color-border);
}

.rows > li::before {
  content: "+";
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  color: var(--color-signal-text);
}

.rows code {
  padding: 0;
  background: none;
  font-size: var(--text-sm);
  color: var(--color-text);
  overflow-wrap: anywhere;
}

.rows h3 {
  margin: 0 0 var(--space-1);
  font-size: var(--text-base);
}

.rows p {
  margin: 0;
  color: var(--color-text-muted);
}

/* Two formats present at once; Markdown stands forward, JSON behind it. */
.formats {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: var(--space-5);
  margin: var(--space-6) 0 0;
}

.formats figure {
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.formats figcaption {
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.formats pre {
  margin: 0;
}

.formats .forward pre {
  border-color: var(--color-text);
  background: var(--color-surface);
  color: var(--color-text);
}

.formats .behind pre {
  color: var(--color-text-faint);
}

.formats figure > p {
  margin: var(--space-3) 0 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.closing {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: var(--space-5);
}

.closing p {
  margin: 0;
}

.closing .actions {
  margin: 0;
}

/* The gateway-rendered Account page ----------------------------------------- */

/* Plan, Usage and Rate limit in one row where they fit; boxes share a height. */
.account-standing {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0 var(--space-5);
}

.shell-account h2 {
  margin-top: var(--space-7);
}

.account-standing h2 {
  margin-top: var(--space-5);
}

.account-standing section {
  display: flex;
  flex-direction: column;
}

.account-standing .account-summary {
  flex: 1;
}

/* A plate directly over its box joins it: one bordered unit, no gap. */
h2:has(+ .account-summary) {
  margin-bottom: 0;
  border: var(--border-width) solid var(--color-border);
}

h2 + .account-summary {
  border-top: 0;
}

/* Preferences beside Authorized clients on a wide screen. */
.account-columns {
  display: grid;
  gap: 0 var(--space-7);
}

@media (min-width: 56rem) {
  .account-columns {
    grid-template-columns: 1fr 1fr;
  }
}

/* A summary is a data region: one size, names faint in the gutter column. */
.account-summary {
  display: grid;
  grid-template-columns: minmax(6rem, max-content) 1fr;
  gap: var(--space-2) var(--space-5);
  margin: 0 0 var(--space-5);
  padding: var(--space-4);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-surface);
  font-size: var(--text-sm);
}

.account-summary dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  padding-top: 0.15em;
}

.account-summary dd {
  margin: 0;
  overflow-wrap: break-word;
  font-variant-numeric: tabular-nums;
}

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

.account-actions {
  margin: 0 0 var(--space-4);
}

.client-row {
  padding-block: var(--space-4);
  border-top: var(--border-width) solid var(--color-border);
}

.client-row h3 {
  margin-top: 0;
}

/* The Preferences form, one labelled control per line. No inline style. */
.preferences {
  max-width: var(--measure);
}

.preferences p {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  margin: 0 0 var(--space-4);
}

.preferences label {
  flex: 0 0 10rem;
  color: var(--color-text-muted);
}

.preferences select,
.preferences input[type="number"] {
  font: inherit;
  padding: var(--space-2) var(--space-3);
  border: var(--border-width) solid var(--color-border-control);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  min-width: 8rem;
}

.preferences select:hover,
.preferences input[type="number"]:hover {
  border-color: var(--color-text);
}

.preferences select:disabled,
.preferences input:disabled {
  color: var(--color-text-faint);
  border-color: var(--color-border);
  cursor: not-allowed;
}

.preferences input[type="checkbox"] {
  margin: 0;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--color-signal);
}

.preferences .note {
  display: block;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

/* The video style picker: one radio per style the backend lists, each with a
   sample of the Markdown it produces. The chosen one stands forward. */
.video-styles {
  margin: 0 0 var(--space-4);
  padding: 0;
  border: 0;
  min-width: 0;
}

.video-styles legend {
  padding: 0;
  margin-bottom: var(--space-2);
  color: var(--color-text-muted);
}

.video-styles > .note {
  margin-bottom: var(--space-3);
}

.preferences .video-style {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: var(--space-1) var(--space-3);
  padding: var(--space-3);
  margin-bottom: var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  cursor: pointer;
}

.preferences .video-style:hover {
  border-color: var(--color-border-control);
}

.video-style:has(input:checked) {
  border-color: var(--color-text);
  background: var(--color-surface);
  color: var(--color-text);
}

.video-style input[type="radio"] {
  margin: 0;
  accent-color: var(--color-signal);
}

.video-style-sample {
  grid-column: 2;
  display: block;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--color-code-bg);
  color: var(--color-code-text);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}

/* The /try playground ------------------------------------------------------ */

/* The form page: a heading, the one-line form, and three steps. */
.try-hero {
  max-width: 48rem;
  padding-top: var(--space-5);
}

.try-hero h1 {
  font-size: var(--text-display);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-display);
  margin: 0 0 var(--space-4);
}

.try-lede {
  max-width: var(--measure);
  margin: 0 0 var(--space-6);
  font-size: var(--text-lg);
  color: var(--color-text-muted);
}

/* The steps: plus lines of a timetable, not numbered cards. */
.try-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  max-width: none;
  margin: var(--space-8) 0 0;
  padding: 0;
  border-top: var(--border-width) solid var(--color-border);
  list-style: none;
}

.try-steps li {
  margin: 0;
  padding: var(--space-4) var(--space-4) var(--space-4) 0;
}

.try-steps li + li {
  padding-left: var(--space-4);
  border-left: var(--border-width) solid var(--color-border);
}

.try-steps b {
  display: block;
  margin-bottom: var(--space-2);
  font-weight: var(--weight-medium);
  color: var(--color-text);
}

.try-steps b::before {
  content: "+ ";
  font-family: var(--font-mono);
  color: var(--color-signal-text);
}

.try-steps p {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* The result page: the same form, compact, above the output. */
.try-bar h1 {
  margin: 0 0 var(--space-3);
  font-size: var(--text-xl);
}

.try-bar .try-form label[for="url"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.try-form {
  display: grid;
  gap: var(--space-2);
}

.try-run {
  display: flex;
  gap: var(--space-3);
}

.try-run input[type="url"] {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  padding: var(--space-3);
  border: var(--border-width) solid var(--color-border-control);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}

.try-run input[type="url"]:hover {
  border-color: var(--color-text);
}

.try-run input[type="url"]::placeholder {
  color: var(--color-text-faint);
}

.try-run .button {
  white-space: nowrap;
}

.try-disclosure,
.try-allowance,
.try-wait {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.try-disclosure p {
  margin: 0;
}

.try-disclosure summary {
  display: block;
  cursor: pointer;
  color: var(--color-text);
}

.try-disclosure summary::-webkit-details-marker {
  display: none;
}

/* Folded is "+", open is "-": the diff's own marks in place of a triangle. */
.try-disclosure summary::before {
  content: "+";
  display: inline-block;
  width: var(--cell-mark);
  font-family: var(--font-mono);
  color: var(--color-signal-text);
}

.try-disclosure details[open] > summary::before {
  content: "-";
  color: var(--color-text-faint);
}

.try-disclosure details[open] > * + * {
  margin-top: var(--space-2);
}

.try-disclosure details[open] > summary {
  margin-bottom: var(--space-2);
}

.try-allowance {
  color: var(--color-text-faint);
}

/* Call states are marks in a gutter cell: ~ fetching, ! failed, \ cut. */
.try-wait::before,
.try-error::before,
.try-preview-cut::before {
  display: inline-block;
  width: var(--cell-mark);
  font-family: var(--font-mono);
  font-weight: var(--weight-medium);
  color: var(--color-signal-text);
}

.try-wait::before {
  content: "~";
}

.try-error::before {
  content: "!";
}

.try-preview .try-preview-cut::before {
  content: "\\";
}

/* A /try failure: a plate above the form, so it reads as the result. */
.try-error {
  padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid var(--color-signal);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: var(--weight-medium);
}

/* The size strip, a data region. The container's color shows through the gaps
   as the rules between cells, however many cells wrap onto a line. */
.try-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: var(--border-width);
  margin: var(--space-6) 0 var(--space-5);
  border: var(--border-width) solid var(--color-border);
  background: var(--color-border);
}

.try-stat {
  min-width: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--color-bg);
}

.try-stat dt {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.try-stat dd {
  margin: var(--space-1) 0 0;
  font-family: var(--font-mono);
  font-size: var(--text-xl);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.try-stat dd small {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.try-stat-signal dd {
  color: var(--color-signal-text);
}

/* Before and after: the page as fetched (minus, dim), beside what your agent
   gets (plus, full ink). */
.try-compare {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: var(--space-5);
}

.try-compare.try-no-raw {
  grid-template-columns: minmax(0, 1fr);
}

.try-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: var(--border-width) solid var(--color-border);
  background: var(--color-surface);
}

.try-out {
  border-color: var(--color-border-control);
}

.try-pane-head,
.try-pane-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-3) var(--space-4);
}

.try-pane-head {
  border-bottom: var(--border-width) solid var(--color-border);
}

.try-pane h2 {
  margin: 0 auto 0 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--text-base);
}

.try-pane h2::before {
  content: none;
}

.try-raw .try-pane-head h2::before {
  content: "- ";
  position: static;
  translate: none;
  font-family: var(--font-mono);
  color: var(--color-text-faint);
}

.try-out .try-pane-head h2::before {
  content: "+ ";
  position: static;
  translate: none;
  font-family: var(--font-mono);
  color: var(--color-signal-text);
}

.try-pane-foot {
  margin-top: auto;
  border-top: var(--border-width) solid var(--color-border);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.try-pane-foot p {
  flex: 1 1 16rem;
  margin: 0;
}

.try-count {
  margin: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-muted);
}

.try-actions {
  display: flex;
  gap: var(--space-3);
}

/* The script un-hides these buttons; .button's display would otherwise beat the
   hidden attribute's, so a no-JS visitor would see dead buttons. */
.button[hidden] {
  display: none;
}

.try-body {
  display: block;
  width: 100%;
  height: min(70vh, 44rem);
  margin: 0;
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-code-text);
}

textarea.try-body {
  resize: none;
  padding: var(--space-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: var(--leading-body);
}

.try-raw .try-body {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.try-unavailable {
  padding: var(--space-4);
  color: var(--color-text-muted);
}

/* A segmented control: radio inputs hidden from sight but not from the
   keyboard or a screen reader, each styled through its label. The chosen
   option is reversed. */
.try-seg {
  display: inline-flex;
  border: var(--border-width) solid var(--color-border-control);
}

.try-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.try-seg label {
  padding: var(--space-1) var(--space-3);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  cursor: pointer;
}

.try-seg label:hover {
  color: var(--color-text);
}

.try-seg label + input + label {
  border-left: var(--border-width) solid var(--color-border-control);
}

.try-seg input:checked + label {
  background: var(--color-text);
  color: var(--color-bg);
}

.try-seg input:focus-visible + label {
  outline: var(--outline-width) solid var(--color-focus);
  outline-offset: 2px;
}

.try-seg code {
  font-size: var(--text-xs);
}

/* Which output shows. Without :has(), the first profile's Markdown shows and
   the switches do nothing, which still leaves a usable page. */
.try-out .try-body,
.try-out .try-note {
  display: none;
}

.try-out .try-body:first-of-type,
.try-out .try-note:first-of-type {
  display: block;
}

@supports selector(:has(*)) {
  .try-out .try-body:first-of-type,
  .try-out .try-note:first-of-type {
    display: none;
  }

  .try-out:has(#try-profile-free:checked):has(#try-view-markdown:checked) .try-body-free-markdown,
  .try-out:has(#try-profile-free:checked):has(#try-view-preview:checked) .try-body-free-preview,
  .try-out:has(#try-profile-signed:checked):has(#try-view-markdown:checked) .try-body-signed-markdown,
  .try-out:has(#try-profile-signed:checked):has(#try-view-preview:checked) .try-body-signed-preview,
  .try-out:has(#try-profile-free:checked) .try-note-free,
  .try-out:has(#try-profile-signed:checked) .try-note-signed {
    display: block;
  }
}

/* Rendered Markdown, for reading. Headings here are the page's own, so they
   drop the site's hunk-header plate. */
.try-preview {
  padding: var(--space-4) var(--space-5);
  color: var(--color-text);
}

.try-preview > :first-child {
  margin-top: 0;
}

.try-preview h1 {
  font-size: var(--text-2xl);
}

.try-preview h2 {
  margin: var(--space-6) 0 var(--space-3);
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--text-xl);
}

.try-preview h2::before {
  content: none;
}

.try-preview h3 {
  font-size: var(--text-lg);
}

.try-preview pre {
  overflow: auto;
  padding: var(--space-3);
  background: var(--color-code-bg);
}

.try-preview table {
  display: block;
  overflow: auto;
  border-collapse: collapse;
}

.try-preview th,
.try-preview td {
  padding: var(--space-1) var(--space-2);
  border: var(--border-width) solid var(--color-border);
}

.try-preview blockquote {
  margin-inline: 0;
  padding-left: var(--space-4);
  border-left: var(--border-width) solid var(--color-border-control);
  color: var(--color-text-muted);
}

.try-preview .try-front {
  margin: 0 0 var(--space-5);
  padding: var(--space-3);
  background: var(--color-code-bg);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.try-preview .try-image {
  color: var(--color-text-faint);
  font-size: var(--text-sm);
}

.try-preview .try-preview-cut {
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* What to do next. */
.try-next {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin-top: var(--space-7);
  border: var(--border-width) solid var(--color-border);
}

.try-next section {
  padding: var(--space-5);
}

.try-next section + section {
  border-left: var(--border-width) solid var(--color-border);
}

.try-next h2 {
  margin: 0 0 var(--space-2);
  padding: 0;
  border: 0;
  background: none;
  font-size: var(--text-lg);
}

.try-next h2::before {
  content: none;
}

.try-next p {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
}

/* Phones: one column, and the before/after becomes two tabs. */
.try-tabs {
  display: none;
}

/* Narrow screens ---------------------------------------------------------- */

@media (max-width: 64rem) {
  .patch-body {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

  .patch h1 {
    max-width: 20ch;
  }
}

@media (max-width: 56.25rem) {
  .try-compare,
  .try-next,
  .try-steps {
    grid-template-columns: minmax(0, 1fr);
  }

  .try-steps li,
  .try-steps li + li {
    padding: var(--space-3) 0;
    border-left: 0;
    border-bottom: var(--border-width) solid var(--color-border);
  }

  .try-next section + section {
    border-left: 0;
    border-top: var(--border-width) solid var(--color-border);
  }

  .try-run {
    flex-direction: column;
  }

  .try-body {
    height: 65vh;
  }

  .try-tabs {
    display: inline-flex;
    justify-self: start;
  }

  .try-compare:has(#try-show-out:checked) .try-raw,
  .try-compare:has(#try-show-raw:checked) .try-out {
    display: none;
  }
}

@media (max-width: 48rem) {
  .formats,
  .closing {
    grid-template-columns: minmax(0, 1fr);
  }

  .rows > li {
    grid-template-columns: var(--cell-mark) minmax(0, 1fr);
  }

  .rows > li > :last-child {
    grid-column: 2;
  }

  /* No room for the gutter numbers; the hunk plates stay. */
  .doc > :where(h1, h3, p, ul, ol, dl, table, .disclosure)::before {
    content: none;
  }

  .doc > h2 {
    margin-left: 0;
    padding-left: calc(var(--space-4) + var(--space-6));
  }

  .doc > h2::before {
    content: "@@";
    left: var(--space-4);
    width: auto;
    text-align: left;
  }
}

@media (max-width: 30rem) {
  h1 {
    font-size: var(--text-2xl);
  }

  .patch {
    padding-block: var(--space-6) var(--space-7);
  }

  .endpoint code {
    font-size: var(--text-sm);
  }

  .rows code {
    font-size: var(--text-xs);
  }

  .compare-view {
    height: 24rem;
  }

  .compare .l > i {
    padding-right: var(--cell-1);
  }

  .site-header .site-nav a {
    padding-inline: var(--space-2);
  }

  .account-summary {
    gap: var(--space-2) var(--space-4);
  }

  .preferences label {
    flex-basis: 100%;
  }
}

.formats .forward pre code {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
