/*
 * beautiful.site's own pages, on the UI kit (kit.css, built from ui/src/styles by
 * scripts/build-site-css.mjs) and its Websites guide: ink and white, a lot of white space, glass
 * on a stage of indigo and marigold, and the reader's own light or dark mode. No webfont.
 *
 * These are the few hooks the guide doesn't have. They're unlayered, so they win over the kit, and
 * they read only the kit's tokens, and --color-rule below: no color of their own.
 */

/*
 * A flat rule between rows and around boxes: 12% of the text, so it shows on the page in every theme
 * and mode. Not the kit's --color-hairline, which glass's dark mode turns into a dark groove that needs
 * its lit edge (--hairline-lit) to show on a dark page.
 */
:root {
  --color-rule: color-mix(in oklab, currentColor 12%, transparent);
}

/* The strip over the header for an agent in a hurry: ink, the reverse of the page. */
[data-topbar] {
  margin: 0;
  padding: var(--space-2) var(--space-gutter);
  background: var(--color-text);
  color: var(--color-page);
  font-size: var(--text-sm);
  line-height: var(--leading-sm);
  text-align: center;
  a, code { color: inherit; }
  a { text-decoration-color: color-mix(in srgb, currentColor 50%, transparent); }
  code { background: color-mix(in srgb, currentColor 14%, transparent); }
}

[data-home] { display: inline-flex; }
[data-logo] { inline-size: auto; }
@media (width < 40rem) {
  /* On a phone the header keeps the logo and the one action. */
  header[data-section="bar"] nav a[data-variant="tertiary"] { display: none; }
  [data-logo] { block-size: 1.375rem; }
}

/* Two blocks side by side, the first wider, one over the other on a phone. */
beautiful-split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
  align-items: center;
  gap: var(--space-12);
  &[data-align="start"] { align-items: start; }
}

/* Paragraphs one under another. */
beautiful-stack {
  display: grid;
  gap: var(--space-4);
  &[data-align="center"] { justify-items: center; text-align: center; }
}

[data-hero] { padding-block-start: var(--space-12); }
[data-rating] strong { letter-spacing: 0.1em; margin-inline-end: var(--space-1); }
mark[data-nowrap] { white-space: nowrap; }

/* The publish call in the hero: code on a glass pane, which catches the stage. */
figure[data-terminal] {
  margin: 0;
  min-inline-size: 0;
  pre {
    margin: 0;
    overflow-x: auto;
    font-size: var(--text-sm);
    line-height: 1.75;
  }
  b { font-weight: 700; }
  i { font-style: normal; color: var(--color-indigo); font-weight: 600; }
}

/* Pains: each a bold line, then its story, with an ink rule at the side. */
[data-pains] {
  margin-block: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-6);
  li {
    padding-inline-start: var(--space-5);
    border-inline-start: 2px solid var(--color-text);
    color: var(--color-text-muted);
    font-size: var(--text-lg);
    line-height: var(--leading-lg);
  }
  strong { display: block; color: var(--color-text); font-size: var(--text-xl); line-height: var(--leading-xl); }
}

/* A grid whose items each start under a hairline. */
beautiful-grid[data-ruled] > * {
  padding-block-start: var(--space-4);
  border-block-start: 1px solid var(--color-rule);
}

/* Rows of a label and its words, ruled between: a timeline, or what a human asks next. */
[data-rows] {
  margin-block: 0;
  padding: 0;
  list-style: none;
  li {
    display: grid;
    grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
    gap: var(--space-1) var(--space-6);
    padding-block: var(--space-4);
    border-block-start: 1px solid var(--color-rule);
    &:last-child { border-block-end: 1px solid var(--color-rule); }
  }
  &[data-rows="wide"] li { grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); }
  strong { font-variant-numeric: tabular-nums; }
  p { color: var(--color-text-muted); }
  @media (width < 40rem) { li, &[data-rows="wide"] li { grid-template-columns: minmax(0, 1fr); } }
}

/* A plugin against code you write: the left column muted, the right in ink. */
beautiful-table[data-versus] {
  td { inline-size: 50%; vertical-align: top; white-space: normal; font-size: var(--text-base); color: var(--color-text-muted); }
  td + td { color: var(--color-text); font-weight: 500; }
  @media (width < 40rem) {
    thead { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); }
    table, tbody, tr, td { display: block; inline-size: auto; }
    tr + tr { border-block-start: 1px solid var(--color-rule); }
    /* The kit gives a cell its row height, which only a table cell may outgrow. Stacked as blocks, it must grow too. */
    td { border: 0; padding-block: var(--space-1); block-size: auto; }
    td::before { content: attr(data-label) ": "; color: var(--color-text-muted); font-weight: 400; }
  }
}

/* What agents say. */
beautiful-grid[data-quotes] figure {
  margin: 0;
  blockquote { margin: 0; font-size: var(--text-lg); line-height: var(--leading-lg); font-weight: 600; }
  figcaption { color: var(--color-text-muted); font-size: var(--text-sm); }
  figcaption::before { content: "— "; }
}

/* The offer: a card of terms, ruled between. */
article[data-offer] ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: var(--space-4);
  color: var(--color-text-muted);
  li + li { padding-block-start: var(--space-4); border-block-start: 1px solid var(--color-rule); }
  strong { color: var(--color-text); }
}

/* Three numbered steps, the number large and quiet. */
ol[data-steps] {
  margin-block: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  gap: var(--space-8);
  li {
    counter-increment: step;
    display: grid;
    grid-template-columns: var(--space-12) minmax(0, 1fr);
    gap: var(--space-2) var(--space-4);
    &::before {
      content: counter(step);
      grid-row: span 2;
      font-size: var(--text-3xl);
      line-height: var(--leading-3xl);
      font-weight: 700;
      color: var(--color-indigo);
    }
  }
  p { color: var(--color-text-muted); }
}

/* Questions: two columns of disclosures on a phone's one. */
beautiful-grid[data-faq] {
  grid-template-columns: repeat(auto-fit, minmax(min(26rem, 100%), 1fr));
  align-items: start;
  gap: var(--space-2) var(--space-12);
  summary { font-weight: 600; }
}

/*
 * The prompt to paste: drawn like the message box of an AI chat (Jacob, 2026-11-06), a wide
 * rounded composer with the words already typed, a blinking caret, an attach mark at the left and
 * a round send-style copy button at the right.
 */
article[data-prompt] {
  display: grid;
  gap: var(--space-4);
  inline-size: 100%;
  max-inline-size: 42rem;
  padding: var(--space-4) var(--space-4) var(--space-3) var(--space-5);
  border: 1px solid var(--color-rule);
  border-radius: calc(var(--radius-xl) * 1.75);
  background: var(--color-raised);
  box-shadow: var(--shadow-3);
  text-align: start;
  output {
    display: block;
    min-block-size: 3.5rem;
    padding-block-start: var(--space-1);
    font-size: var(--text-lg);
    line-height: var(--leading-lg);
    overflow-wrap: anywhere;
  }
  output::after {
    content: "";
    display: inline-block;
    inline-size: 2px;
    block-size: 1.15em;
    margin-inline-start: 2px;
    vertical-align: text-bottom;
    background: var(--color-accent);
    animation: prompt-caret 1.1s steps(1) infinite;
  }
  footer { display: flex; align-items: center; gap: var(--space-3); }
  footer > svg {
    flex: none;
    /* A quiet mark, not a ring: it isn't a control, so it mustn't look tappable. */
    inline-size: 1.25rem;
    block-size: 1.25rem;
    color: var(--color-text-muted);
    opacity: 0.6;
  }
  footer > p { flex: 1; margin: 0; }
  /* On a phone the hint goes under the controls, so the button keeps its row. */
  @media (width < 30rem) {
    footer { flex-wrap: wrap; }
    footer > p:not([data-toast]) { order: 3; flex-basis: 100%; }
    footer > button { margin-inline-start: auto; }
  }
}
/*
 * The send arrow, on the prompt box and on each chat box beside the authors hero: it copies the
 * prompt, and so does a click on the words. Hover or focus names it; a click shows the copied alert.
 */
:is(article[data-prompt], beautiful-stack[data-chats] article) {
  position: relative;
  > :is(output, p):first-child { cursor: pointer; }
  footer > button[data-send] {
    flex: none;
    display: grid;
    place-items: center;
    inline-size: 2.75rem;
    block-size: 2.75rem;
    /* A circle: the kit's buttons have a min-height of a control, taller than the chat boxes' 2rem. */
    min-block-size: 0;
    padding: 0;
    border: 0;
    border-radius: var(--radius-full);
    background: var(--color-text);
    color: var(--color-page);
    cursor: pointer;
    position: relative;
    svg { inline-size: 1.25rem; block-size: 1.25rem; }
  }
  @media (hover: hover) { footer > button[data-send]:hover { background: var(--color-text-muted); } }
  footer > button[data-send]:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
  /* The kit draws a rim on buttons with ::before; a send button has none. ::after is the tooltip. */
  footer > button[data-send]::before { content: none; }
  footer > button[data-send]::after {
    position: absolute;
    inset-block-end: calc(100% + var(--space-2));
    inset-inline-end: 0;
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-md);
    background: var(--color-text);
    color: var(--color-page);
    font-size: var(--text-sm);
    font-weight: 600;
    line-height: var(--leading-sm);
    inline-size: max-content;
    max-inline-size: min(18rem, 80vw);
    box-shadow: var(--shadow-2);
    pointer-events: none;
  }
  footer > button[data-send]::after {
    content: attr(aria-label);
    opacity: 0;
    translate: 0 4px;
    transition: opacity 120ms, translate 120ms;
  }
  footer > button[data-send]:focus-visible::after { opacity: 1; translate: 0 0; }
  @media (hover: hover) { footer > button[data-send]:hover::after { opacity: 1; translate: 0 0; } }
  /* While the copied note shows, it takes the tooltip's place. */
  footer:has(> p[data-toast]:not(:empty)) > button[data-send]::after { opacity: 0; }
  /*
   * The copied note can't be missed: a green alert under the whole box, centered,
   * well clear of the tooltip above the button (Jacob, 2026-11-06).
   */
  footer > p[data-toast] {
    position: absolute;
    z-index: 2;
    inset-block-start: calc(100% + var(--space-3));
    inset-inline: 0;
    inline-size: max-content;
    max-inline-size: calc(100% - var(--space-4));
    margin: 0 auto;
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    background: var(--color-success);
    /* The page's own color: white on the light theme's deep green, near-black on the dark theme's bright one. */
    color: var(--color-page);
    font-size: var(--text-base);
    font-weight: 400;
    line-height: var(--leading);
    text-align: center;
    box-shadow: var(--shadow-3);
    pointer-events: none;
    animation: prompt-toast 200ms ease-out;
  }
  /* "Copied!" in bold, a small gap, then what to do next in plain text. */
  footer > p[data-toast] > strong { margin-inline-end: var(--space-1); font-weight: 700; }
  /* Nothing was copied, only selected: not green. */
  footer > p[data-toast][data-tone="warning"] { background: var(--color-text); color: var(--color-page); font-weight: 600; }
  @media (width < 30rem) { footer > p[data-toast] { padding-inline: var(--space-4); font-size: var(--text-sm); } }
  /* Empty, it stays in place (a live region must exist before it speaks) but shows nothing. */
  footer > p[data-toast]:empty { padding: 0; opacity: 0; box-shadow: none; animation: none; }
  @media (prefers-reduced-motion: reduce) {
    footer > p[data-toast] { animation: none; }
    footer > button[data-send]::after { transition: none; }
  }
}
@keyframes prompt-caret { 50% { opacity: 0; } }
@keyframes prompt-toast { from { opacity: 0; translate: 0 -6px; } }
@media (prefers-reduced-motion: reduce) { article[data-prompt] output::after { animation: none; } }

/*
 * A block of reading text at the wide width, but on the page's left edge with the headlines, not
 * centered under them as data-width centers.
 */
[data-measure] {
  max-inline-size: var(--width-wide);
  margin-inline: max(0px, (100% - var(--width-page)) / 2) auto;
}
beautiful-hero > :is(h1, h2) { max-inline-size: var(--width-wide); }
/* Three across on a laptop, for a grid of nine. */
beautiful-grid[data-columns="3"] { grid-template-columns: repeat(auto-fit, minmax(min(20rem, 100%), 1fr)); }
beautiful-grid[data-columns="2"] { grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr)); }
@media (width < 40rem) { figure[data-terminal] pre { font-size: var(--text-xs); } }

/* Legal, support and docs pages: one article of prose under its headline. */
article[data-section] > beautiful-hero[data-width="prose"] { inline-size: 100%; }
article[data-section]:has(> beautiful-prose > beautiful-table) { container-type: inline-size; }
beautiful-prose {
  overflow-wrap: break-word;
  /* A table in the text steps out to the wide width, centered on the text, so its columns have room. */
  > beautiful-table {
    --table-width: min(var(--width-wide), 100cqi);
    inline-size: var(--table-width);
    max-inline-size: none;
    margin-inline: calc((100% - var(--table-width)) / 2);
    th, td { vertical-align: top; }
    th[scope="row"] { min-inline-size: 9rem; }
    td { min-inline-size: 8rem; }
  }
}
/* The error reference: an index of codes, then a section per code, each starting under a hairline. */
beautiful-prose[data-errors] {
  nav ul { margin: 0; padding: 0; list-style: none; gap: var(--space-2) var(--space-4); }
  nav li { margin: 0; }
  nav code { font-size: var(--text-sm); }
  > section {
    display: grid;
    gap: var(--space-3);
    margin-block-start: var(--space-12);
    padding-block-start: var(--space-6);
    border-block-start: 1px solid var(--color-rule);
    scroll-margin-block-start: var(--space-6);
  }
  > section h2 { font-size: var(--text-xl); line-height: var(--leading-xl); }
}
/* A short page ends on the page's white, not the app canvas under it. */
body { background: var(--color-page); }
/* Not found: the headline in the middle of the page. */
article[data-notfound] { min-block-size: 50vh; align-content: center; }

/*
 * Authors, the hero: what readers might say to their AI, each typed into a chat box like the
 * postcards' (Jacob, 2026-11-06): the words, then a plus, a mic and a round send arrow that copies
 * that prompt, like the main box's. A little askew, like cards on a table.
 */
beautiful-stack[data-chats] {
  gap: var(--space-5);
  padding-block: var(--space-4);
  article {
    display: grid;
    gap: var(--space-4);
    inline-size: min(100%, 26rem);
    padding: var(--space-4) var(--space-4) var(--space-3) var(--space-5);
    border: 1px solid var(--color-rule);
    border-radius: calc(var(--radius-xl) * 1.5);
    background: var(--color-raised);
    box-shadow: var(--shadow-3);
    font-size: var(--text-base);
    line-height: var(--leading);
    p { margin: 0; }
    footer { display: flex; align-items: center; gap: var(--space-3); color: var(--color-text-muted); }
    footer > svg:first-child { margin-inline-end: auto; }
    svg { inline-size: 1.25rem; block-size: 1.25rem; }
    footer > button[data-send] { inline-size: 2rem; block-size: 2rem; }
    footer > button[data-send] svg { inline-size: 1rem; block-size: 1rem; }
    /* The alert keeps to one line, even under the short pill. */
    footer > p[data-toast] { max-inline-size: none; white-space: nowrap; }
  }
  /* The short one is a single-line pill, its arrow still grey: nothing sent yet. */
  article[data-chat="pill"] {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    inline-size: auto;
    padding-block: var(--space-2);
    border-radius: var(--radius-full);
    footer > button[data-send] { background: var(--color-rule); color: var(--color-text); }
    /* The pill sits at the stack's end, so its alert lines up with that edge, not past it. */
    footer > p[data-toast] { inset-inline: auto 0; margin: 0; }
    @media (hover: hover) { footer > button[data-send]:hover { background: var(--color-text-muted); color: var(--color-page); } }
  }
  /* A box showing its copied alert comes to the front, so the next card can't cover it. */
  article:has(p[data-toast]:not(:empty)) { z-index: 3; }
  article:nth-child(1) { rotate: -2deg; justify-self: start; }
  article:nth-child(2) { rotate: 1.5deg; justify-self: end; }
  article:nth-child(3) { rotate: -1deg; justify-self: start; margin-inline-start: var(--space-6); }
  article:nth-child(4) { rotate: 2deg; justify-self: end; }
  @media (width < 40rem) { display: none; }
}
beautiful-hero > article[data-prompt] { margin-block-start: var(--space-4); }
q { quotes: "“" "”"; font-weight: 600; }

/* Authors, what to ask for: the sentence itself, in ink, with a rule at its side. */
p[data-ask] {
  margin-block-start: var(--space-2);
  padding-inline-start: var(--space-3);
  border-inline-start: 2px solid var(--color-text);
  font-weight: 600;
}

/* Authors, the example sites: screenshots at their own 16:10. */
beautiful-grid[data-examples] { --card-media-ratio: 16 / 10; }

/* Authors, the recipes: each prompt set apart as the words to paste. */
beautiful-grid[data-recipes] {
  h3 { font-size: var(--text-lg); line-height: var(--leading-lg); }
  code {
    display: block;
    padding: var(--space-3);
    border: 1px solid var(--color-rule);
    border-radius: var(--radius-md);
    /* A sentence to paste, so it reads in the page's face, not as code. */
    font-family: inherit;
    font-size: var(--text-sm);
    line-height: var(--leading-sm);
    white-space: normal;
  }
}

/* Authors, the footer's two lines, close together. */
footer[data-section="bar"] beautiful-stack { gap: var(--space-1); }

/* Audience pages: the three promises under the prompt, each after a check mark. */
ul[data-checks] {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--text-sm);
  font-weight: 600;
  li::before { content: "✓"; content: "✓" / ""; margin-inline-end: var(--space-2); color: var(--color-indigo); }
}

/*
 * "Send this to my laptop" under the authors hero (laptop.js): for visitors on a phone, so it's gone on a
 * wide screen. The address and its button share a row until the row is too narrow for both.
 */
form[data-laptop] {
  display: grid;
  gap: var(--space-2);
  margin-block-start: var(--space-6);
  padding-block-start: var(--space-5);
  border-block-start: 1px solid var(--color-rule);
  label { font-size: var(--text-sm); }
  beautiful-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
  input { flex: 1 1 10rem; inline-size: auto; min-inline-size: 0; }
  beautiful-turnstile:empty { display: none; }
  p[role="status"][data-state] { color: var(--color-text); font-weight: 600; }
  @media (width >= 64rem) { display: none; }
}

/*
 * The header's Solutions menu: a popover (no script), listing the audience pages. It opens under
 * its button where the browser can anchor it, or under the header's right end where it can't.
 */
button[data-solutions] {
  anchor-name: --solutions;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  svg { inline-size: 1rem; block-size: 1rem; }
}
/* On a phone the logo, Solutions and the one action share a row. */
@media (width < 40rem) {
  header[data-section="bar"] nav { gap: var(--space-2); }
  header[data-section="bar"] > beautiful-row { column-gap: var(--space-3); }
  button[data-solutions] { padding-inline: var(--space-2); }
}
nav#solutions {
  position: fixed;
  inset: 4rem var(--space-4) auto auto;
  inline-size: min(22rem, calc(100vw - 2 * var(--space-4)));
  margin: 0;
  padding: var(--space-2);
  border: 1px solid var(--color-rule);
  border-radius: var(--radius-lg);
  background: var(--color-raised);
  color: var(--color-text);
  box-shadow: var(--shadow-3);
  a {
    display: grid;
    gap: 2px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: inherit;
    text-decoration: none;
  }
  a:is(:hover, :focus-visible) { background: var(--color-rule); }
  strong { font-weight: 600; }
  small { color: var(--color-text-muted); font-size: var(--text-sm); }
}
nav#solutions::before { content: none; }
@supports (position-anchor: --solutions) {
  nav#solutions {
    position-anchor: --solutions;
    inset: auto;
    position-area: bottom span-left;
    margin-block-start: var(--space-2);
  }
}
/* On a phone it spans the screen under the header, 1rem in from each side. */
@media (width < 40rem) {
  nav#solutions { position-area: none; inset: 3.75rem var(--space-4) auto; inline-size: auto; margin: 0; }
  @supports (position-anchor: --solutions) {
    nav#solutions { inset: auto var(--space-4); inset-block-start: calc(anchor(bottom) + var(--space-2)); }
  }
}

/* The footer: five short columns of links beside the line about us; two to a row on a phone. */
footer[data-section="bar"] > beautiful-row { align-items: start; flex-wrap: wrap; gap: var(--space-6); }
nav[aria-label="Footer"][data-columns] {
  display: grid;
  grid-template-columns: repeat(5, auto);
  gap: var(--space-6) var(--space-8);
  section > p { margin: 0 0 var(--space-2); font-size: var(--text-sm); line-height: var(--leading-sm); font-weight: 600; }
  ul { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; font-size: var(--text-sm); }
  @media (width < 48rem) { flex-basis: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--space-4); }
}

/* Help center: the topics close together under one hero, each card the same width. */
section[data-help] {
  padding-block-start: 0;
  > section { display: grid; gap: var(--space-3); }
  > section + section { margin-block-start: var(--space-12); }
  > section > p { margin: 0; }
  beautiful-grid { grid-template-columns: repeat(auto-fill, minmax(min(20rem, 100%), 1fr)); margin-block-start: var(--space-2); }
  h3 { font-size: var(--text-lg); line-height: var(--leading-lg); }
}

/* Connect: the address to add, in a card under the hero's words, copied with one button. */
article[data-address] {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-1) var(--space-4);
  margin-block-start: var(--space-4);
  > p { grid-column: 1 / -1; margin: 0; }
  code { font-size: var(--text-lg); line-height: var(--leading-lg); overflow-wrap: anywhere; }
  footer { margin: 0; }
  @media (width < 40rem) { code { font-size: var(--text-sm); line-height: var(--leading-sm); } }
}

/* Connect: each app's steps, inside its disclosure, with room above the first. */
beautiful-accordion[data-apps] {
  details > ol[data-steps] { gap: var(--space-6); padding-block: var(--space-4); }
  details > p { padding-block-end: var(--space-4); }
  summary { font-size: var(--text-lg); font-weight: 600; }
  h3 { font-size: var(--text-base); line-height: var(--leading); }
  /* A step with a command to copy has more than two parts: they all stay in the text column. */
  ol[data-steps] li > * { grid-column: 2; }
  ol[data-steps] li::before { grid-column: 1; grid-row: 1 / span 2; }
  pre { margin-block: var(--space-2); padding: var(--space-3); border: 1px solid var(--color-rule); border-radius: var(--radius-md); overflow-x: auto; font-size: var(--text-sm); }
  code { overflow-wrap: anywhere; }
}
