/* Docs, connect, get-started and showcase pages. Tokens and components:
   site.css. Type, colour, radius and shadow come from tokens only. */

/* ------------------------------------------------------------- docs hub */

.docs-hero {
  padding-bottom: var(--space-8);
}

.docs-hero > .section-head {
  margin-bottom: var(--space-6);
}

.docs-hero > .code-frame {
  max-width: 760px;
}

/* The three steps, said once, in one line above the one call. */
.docs-flow {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-6);
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
  counter-reset: flow;
}

.docs-flow > li {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  max-width: none;
  font-weight: 600;
  counter-increment: flow;
}

.docs-flow > li::before {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  content: counter(flow);
}

.docs-hero-actions {
  margin-top: var(--space-6);
}

.docs-next {
  margin-top: var(--space-7);
}

/* Every card in a row is as tall as the tallest, and each arrow sits on the
   bottom edge of its card, so the row of arrows lines up. Six cards: three
   and three, or one per row on a phone. Never one alone. */
.docs-guides {
  align-items: stretch;
}

.docs-guides > li {
  display: flex;
}

.docs-guides > li > .card {
  flex: 1;
  min-width: 0;
}

.docs-guides .card-link p {
  margin-bottom: var(--space-4);
}

/* Four one-line rules, hairlines between. No boxes. */
.docs-rules {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-rules li {
  max-width: none;
  padding: var(--space-4) 0;
  border-top: 1px solid var(--line-strong);
}

.docs-rules li:last-child {
  border-bottom: 1px solid var(--line-strong);
}

.docs-rules strong {
  display: inline-block;
  min-width: 88px;
}

/* On a phone the label sits on its own line above its rule. */
@media (max-width: 640px) {
  .docs-rules strong {
    display: block;
    min-width: 0;
  }
}

.docs-rules code {
  overflow-wrap: anywhere;
}

/* The one-paragraph definition answer engines quote, one tap away. It is
   the last row of the rules above it, under the same hairline, and not a
   row left over at the end of the page. */
.docs-definition {
  border-color: var(--line-strong);
}

.docs-rules + .docs-definition {
  border-top: 0;
}

.docs-definition > p {
  max-width: 68ch;
}

/* ------------------------------------------------------------- articles */

/* An article is one reading column. It starts on the same left edge as the
   docs hub and the API reference, so the three docs pages share one edge. */
article.docs-article.section-prose {
  padding-inline: max(var(--gutter), calc((100% - var(--content)) / 2));
}

article.docs-article.section-prose > * {
  max-width: var(--prose);
}

.docs-article > .section-head,
.docs-reference > .section-head {
  margin-bottom: var(--space-7);
}

.docs-article :where(ul, ol):not([class]),
.docs-reference :where(ul, ol):not([class]) {
  display: grid;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
}

.docs-block {
  margin-top: var(--space-7);
  scroll-margin-top: calc(var(--header-height) + var(--space-4));
}

.docs-article > .docs-block:first-child {
  margin-top: 0;
}

.docs-block > h2 {
  font-size: var(--text-xl);
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.docs-block > h2 > code {
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.docs-block h3,
.docs-steps h3 {
  margin: var(--space-5) 0 var(--space-2);
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.4;
}

.docs-steps {
  gap: var(--space-7);
  margin: 0;
}

.docs-steps > li {
  min-width: 0;
  scroll-margin-top: calc(var(--header-height) + var(--space-4));
}

.docs-steps > li > :where(p, div, ol, ul, details) + :where(p, div, ol, ul) {
  margin-top: var(--space-4);
}

.docs-steps .button-row {
  margin-bottom: var(--space-4);
}

/* Numbered clicks inside a step: plain numbers, not the big step circles. */
.docs-clicks {
  display: grid;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  padding-left: var(--space-5);
}

/* A second way to do a step, and the fixes: closed until asked for. */
.docs-other-way {
  margin-top: var(--space-5);
}

.docs-trouble {
  margin-top: var(--space-7);
  scroll-margin-top: calc(var(--header-height) + var(--space-4));
}

.docs-article .faq-item > summary :where(h2, h3) {
  margin: 0;
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.4;
}

.table-wrap:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.docs-article .table th code,
.docs-reference .table th code {
  white-space: nowrap;
}

/* ------------------------------------------------------------ reference */

/* A 220px rail and the text column. The rail sticks from 900px up. */
.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: var(--space-7);
}

.docs-toc {
  position: sticky;
  top: calc(var(--header-height) + var(--space-5));
  display: grid;
  gap: var(--space-2);
}

.docs-toc h2 {
  margin: 0;
  color: var(--muted);
  font-size: var(--text-eyebrow);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

/* With .docs-reference in front, so the page's rule for bare lists
   (indent, gap, space under) does not win here. */
.docs-reference .docs-toc ul {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.docs-toc li {
  max-width: none;
}

/* A block link with the same space above and below, so a route that wraps
   onto two lines sits as evenly as one that does not. A long route may
   break anywhere; it never pushes the rail wider. */
.docs-toc a {
  display: block;
  padding: var(--space-2) 0;
  color: var(--text);
  font-size: var(--text-sm);
  line-height: 20px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.docs-toc a:hover {
  color: var(--link);
  text-decoration: underline;
}

@media (pointer: coarse) {
  .docs-toc a {
    padding: var(--space-3) 0;
  }
}

/* The text column runs to the right edge of the page's content width, the
   same edge the docs hub ends on. Paragraphs keep their reading width. */
.docs-body {
  min-width: 0;
}

/* Under 900px the list of sections is one closed row above the text, so
   the first section is in the first screen. From 900px up it is the rail.
   The fold sits in its own nav, named like the rail; only one of the two
   is ever drawn, so a screen reader hears the name once. */
.docs-toc-fold-nav {
  display: none;
}

.docs-toc-fold {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
  font-size: var(--text-sm);
  line-height: 20px;
}

.docs-toc-fold > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--control-height-lg);
  padding: var(--space-4);
  border-radius: var(--radius-card);
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}

.docs-toc-fold > summary::-webkit-details-marker {
  display: none;
}

.docs-toc-fold > summary::after {
  flex: none;
  color: var(--muted);
  font-size: var(--text-xl);
  font-weight: 400;
  line-height: 1;
  content: "+";
  transition: transform var(--fast) var(--ease);
}

.docs-toc-fold[open] > summary::after {
  transform: rotate(45deg);
}

/* With .docs-reference in front, for the same reason as the rail's list. */
.docs-reference .docs-toc-fold > ul {
  gap: 0;
  margin: 0;
  padding: 0 var(--space-4) var(--space-1);
  list-style: none;
}

.docs-toc-fold li {
  max-width: none;
}

.docs-toc-fold a {
  display: flex;
  align-items: center;
  min-height: var(--control-height);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.docs-body > .docs-block:first-child {
  margin-top: 0;
}

/* -------------------------------------------------------------- connect */

.connect-hero > .section-head {
  margin-bottom: var(--space-6);
}

/* The one address, large, with its own Copy button. A long address scrolls
   inside the field and never widens the page. */
.copy-field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 640px;
  margin: 0 auto;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-search);
  background: var(--surface);
}

.copy-field code {
  flex: 1;
  min-width: 0;
  padding: var(--space-2) 0;
  overflow-x: auto;
  background: none;
  font-family: var(--font-mono);
  font-size: var(--text-base);
  line-height: 1.6;
  white-space: nowrap;
}

.copy-field .button {
  flex: none;
}

/* The sentence to hand an AI comes first on the connect page. It is words,
   not an address, so it wraps and never scrolls sideways. */
.copy-field.is-lead {
  flex-wrap: wrap;
  border-width: 1.5px;
  border-color: var(--accent);
  box-shadow: var(--shadow-raised);
}

.copy-field.is-lead code {
  flex: 999 1 260px;
  color: var(--text);
  font-weight: 500;
  overflow-x: visible;
  overflow-wrap: anywhere;
  white-space: normal;
}

.copy-field.is-lead .button {
  flex: 1 0 120px;
  min-height: var(--control-height-lg);
}

.connect-lead-note,
.connect-by-hand {
  max-width: 640px;
  margin-inline: auto;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}

.connect-lead-note {
  margin-top: var(--space-4);
  margin-bottom: 0;
}

.connect-by-hand {
  margin-top: var(--space-7);
  margin-bottom: var(--space-3);
  font-size: var(--text-sm);
}

.connect-actions {
  margin-top: var(--space-5);
}

.connect-visual {
  display: flex;
  justify-content: center;
  max-width: 640px;
  margin: var(--space-8) auto 0;
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--radius-search);
  background: var(--surface);
}

/* Centred under the table, across its whole width. */
.connect-owner {
  max-width: none;
  margin-top: var(--space-5);
  text-align: center;
}

/* ---------------------------------------------------------- get started */

.section-head:not(.is-left) .breadcrumbs-list {
  justify-content: center;
}

.start-cards .card-link {
  height: 100%;
}

.start-cards :where(h2, h3) {
  margin-bottom: var(--space-2);
  font-size: var(--text-xl);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.start-cards .card-link p {
  margin-bottom: var(--space-4);
}

.start-cards :where(h2, h3) + .card-arrow {
  padding-top: var(--space-3);
}

/* A door shows a crop of the product behind it. The crop is a picture: it
   takes no click and no focus, and the card's own words name it. */
.door-visual {
  display: flex;
  justify-content: center;
  height: 192px;
  margin-bottom: var(--space-5);
  padding: var(--space-4) var(--space-4) 0;
  overflow: hidden;
  border-radius: var(--radius-control);
  background: var(--surface-alt);
}

.door-visual > * {
  min-width: 0;
}

/* Three doors side by side need room for their pictures. Below a laptop
   they stack, so no picture is squeezed. */
@media (max-width: 899px) {
  .start-doors {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
  }

  /* The "Pick your AI" cards too: three across leaves about 150px a card
     under 820px, and "Connect ChatGPT" with its arrow needs 165px. */
  .start-cards:not(.start-doors) {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ask-list {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.ask-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  max-width: none;
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: var(--surface);
}

.ask-text {
  min-width: 0;
  font-size: var(--text-sm);
  line-height: 1.5;
}

.ask-list .button {
  flex: none;
  min-width: 84px;
}

/* ------------------------------------------------------------- showcase */

.showcase-head {
  padding-bottom: var(--space-8);
}

.showcase-featured {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  align-items: center;
  gap: var(--space-8);
}

.showcase-featured-copy > .lede {
  max-width: 28ch;
  margin-bottom: var(--space-4);
}

/* A quiet button has padding and no edge. At the start of a left-aligned
   column it steps back by that padding, so its words line up with the
   heading above. */
.showcase-featured-copy > .button-quiet {
  margin-left: calc(-1 * var(--space-3));
}

/* Eight prompts: two across, so each line of a prompt stays readable when
   it is opened. One across on a phone. */
.showcase-prompts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.showcase-prompt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: none;
  min-width: 0;
  scroll-margin-top: calc(var(--header-height) + var(--space-4));
}

.showcase-prompt:target {
  border-color: var(--accent);
}

.showcase-prompt h3 {
  margin-bottom: var(--space-2);
}

.showcase-builds {
  margin-bottom: var(--space-5);
  color: var(--muted);
}

.showcase-full {
  align-self: stretch;
  min-width: 0;
  margin-top: var(--space-3);
}

.showcase-full > summary {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--link);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

/* The whole prompt wraps inside its card and scrolls when it is long. The
   block has the same header bar as every code block, with its own Copy. */
.showcase-full > .code-frame {
  margin: var(--space-2) 0 0;
}

.showcase-full .code-block {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.showcase-full .code-block code {
  overflow-wrap: anywhere;
}

/* The prompts page: links that jump to each group of short asks. The cards
   themselves are in site.css, because the home page shows a few of them. */
.ask-jump {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0 var(--space-5);
  margin-top: var(--space-5);
  font-size: var(--text-sm);
  font-weight: 600;
}

.ask-jump a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.ask-group {
  scroll-margin-top: var(--header-height);
}

/* Six ideas: three and three, two a row on a tablet, one on a phone.
   Never five and one left over. */
.showcase-ideas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, max-content));
  justify-content: center;
  gap: var(--space-2) var(--space-7);
  margin: 0;
  padding: 0;
  list-style: none;
}

.showcase-ideas > li {
  max-width: none;
}

.showcase-ideas .card-arrow {
  min-height: 44px;
  margin-top: 0;
}

/* ----------------------------------------------------------- responsive */

@media (max-width: 899px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

  .docs-toc {
    display: none;
  }

  .docs-toc-fold-nav {
    display: block;
  }

  .showcase-featured {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-6);
  }

  .showcase-ideas {
    grid-template-columns: repeat(2, minmax(0, max-content));
  }
}

@media (max-width: 640px) {
  .showcase-prompts {
    grid-template-columns: minmax(0, 1fr);
  }

  .showcase-ideas {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .connect-visual {
    margin-top: var(--space-7);
    padding: var(--space-5);
  }

  .copy-field {
    padding-left: var(--space-4);
  }

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

@media (max-width: 479px) {
  .ask-list li {
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-3);
  }
}

/* The example app's two ways on: open it, or build one like it. */
.showcase-featured-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
