/*
  Surreal CMS website — design system

  Built on Quiet UI (quiet.css) and Quiet Restyle (restyle.css). Quiet's styles live in cascade layers, so every rule
  here is unlayered and wins without !important. Quiet tokens (--quiet-*) come first; site tokens exist only where
  Quiet has no equivalent. DESIGN.md at the repo root is the spec. Read it before changing anything in this file.

  Contents
    1. Fonts
    2. Tokens (light, dark)
    3. Base
    4. Type
    5. Atmosphere (bloom, glass)
    6. Controls (buttons, pills, forms)
    7. Layout
    8. Site header
    9. Site footer
   10. Page patterns (hero, sections, proof, CTA)
   11. Docs
   12. Blog
   13. Pricing
   14. Auth, error
   15. Legacy content classes
   16. Responsive
   17. Motion
*/

/* 1. Fonts
   ========================================================================== */

/* Cal Sans has one face. It's used for headings and the wordmark only, never below ~22px. */
@font-face {
  font-family: 'Cal Sans';
  src: url('/assets/fonts/cal-sans.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* 2. Tokens
   ========================================================================== */

/* The primary seed matches the Surreal CMS app (surreal-client/src/styles/tokens.css) so the site and the product share
   one brand blue. Quiet re-declares seeds on every scope, so the seeds and heading face are set on all three. */
:root,
.quiet-light,
.quiet-dark {
  --quiet-primary-seed: #5c8de7;
  --quiet-neutral-seed: #9ea2bf;
  --quiet-font-family: system-ui, sans-serif;
  --quiet-font-family-heading: 'Cal Sans', system-ui, sans-serif;
  --quiet-content-spacing: 1.375rem;
}

:root {
  /* Signals, fixed in both themes. Brand blue is the seed; orchid and dusk only tint the bloom. */
  --brand: #5c8de7;
  --periwinkle: #8fb1f2;
  --orchid: #8b7dff;
  --dusk: #5b4fc4;
  --cyan-signal: #7ee7ff;
  --void: #0f1129;

  /* Radii: controls are pills, explanations are large-radius glass */
  /* Cal Sans tracking for headings and big numbers */
  --display-tracking: 1px;

  --radius-glass: 1.5rem;
  --radius-glass-sm: 1rem;

  /* Layout */
  --container: 72rem;
  --container-narrow: 46rem;
  --header-height: 4.5rem;
  --section-space: clamp(4rem, 9vw, 7.5rem);

  /* Motion: slow and small */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --duration: 240ms;
  --grow: 1.025;
  --grow-wide: 1.01;
  --duration-door: 220ms;
  --duration-press: 100ms;
  --ease-door: cubic-bezier(0.2, 0.8, 0.3, 1);
  --ease-settle: cubic-bezier(0.22, 1, 0.36, 1);
  --duration-settle: 360ms;

  /* The door (primary action): a deep brand-blue gradient with a white label in both themes. Each theme tunes the
     fill so white stays above 4.5:1 where the label sits. */
  --door-text: #fff;

  font-synthesis-weight: none;
}

/* Light: paper and mist with a navy cast, a periwinkle wash, never raw white */
:root:not(.quiet-dark),
.quiet-light {
  --quiet-background-color: #f3f4fb;
  --quiet-paper-color: #fafbfe;
  --quiet-text-body: #181a38;
  --quiet-text-muted: #54587b;
  --quiet-code-background-color: #e6e8f6;
  --quiet-code-color: #181a38;

  --paper: #f3f4fb;
  --mist: #e6e8f6;
  --ink: #181a38;
  --ink-faint: #676b8d;
  --signal: var(--quiet-primary-text-colorful);
  --cyan: #0b87a6;
  /* The accent: the logo's orange, used for the scribble underline, <mark>, link hovers, and the eyebrow dot */
  --accent: #f08039;
  --accent-strength: 1;
  --accent-text: #b04e0e;

  --grid-line: rgb(61 68 159 / 0.04);
  --grid-line-major: rgb(61 68 159 / 0.065);
  --card-grid-line: rgb(61 68 159 / 0.1);

  --danger: #d6385e;
  --danger-text: #9d1f3f;
  --danger-fill: rgb(214 56 94 / 0.07);
  --danger-stroke: rgb(214 56 94 / 0.45);
  --danger-ring: rgb(214 56 94 / 0.14);

  --field-stroke: rgb(24 26 56 / 0.17);
  --field-stroke-hover: rgb(24 26 56 / 0.26);

  --segment-track: rgb(24 26 56 / 0.06);
  --segment-track-stroke: rgb(24 26 56 / 0.08);
  --segment-track-shadow: rgb(24 26 56 / 0.06);
  --segment-thumb: #fff;
  --segment-thumb-stroke: rgb(24 26 56 / 0.1);
  --segment-thumb-shadow: 0 1px 2px rgb(24 26 56 / 0.12), 0 3px 8px -3px rgb(24 26 56 / 0.18);

  --glass-fill: rgb(255 255 255 / 0.62);
  --glass-fill-strong: rgb(255 255 255 / 0.72);
  --glass-fill-soft: rgb(255 255 255 / 0.55);
  --glass-hairline: rgb(61 68 159 / 0.11);
  --pill-hairline: var(--glass-hairline);
  --glass-shadow: 0 1px 2px rgb(24 26 56 / 0.04), 0 12px 32px -16px rgb(24 26 56 / 0.12);

  --bloom-wash: radial-gradient(
    ellipse 58% 62% at 68% 12%,
    rgb(101 125 231 / 0.2),
    rgb(119 105 210 / 0.12) 45%,
    rgb(127 101 228 / 0.08) 72%,
    rgb(127 101 228 / 0) 100%
  );
  --door-fill: linear-gradient(135deg, #4a78d6 0%, #3b64c0 50%, #2f52a8 100%);
  --door-glow: 0 8px 20px -10px rgb(47 82 168 / 0.55), inset 0 1px 0 rgb(255 255 255 / 0.2);
  --door-glow-hover: 0 10px 24px -10px rgb(47 82 168 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.25);
  --door-glow-press: 0 5px 14px -8px rgb(47 82 168 / 0.55), inset 0 1px 3px rgb(17 30 70 / 0.16);
  --shimmer: linear-gradient(100deg, #3b64c0 0%, #5c8de7 40%, #0b87a6 70%, #3b64c0 100%);

  --code-base: #161938;
  --header-fill: rgb(243 244 251 / 0.72);
}

/* Dark: void and deep navy, one blue bloom that dusks to violet at its edge */
.quiet-dark {
  --quiet-background-color: #0f1129;
  --quiet-paper-color: #191e3d;
  --quiet-text-body: #eff0ff;
  --quiet-text-muted: #a8acce;
  --quiet-code-background-color: rgb(255 255 255 / 0.08);
  --quiet-code-color: #eff0ff;

  --paper: #0f1129;
  --mist: #191e3d;
  --ink: #eff0ff;
  --ink-faint: #878eb3;
  --signal: var(--quiet-primary-text-colorful);
  --cyan: var(--cyan-signal);
  --accent: #f59a55;
  --accent-strength: 1.6;
  --accent-text: var(--accent);

  --grid-line: rgb(255 255 255 / 0.02);
  --grid-line-major: rgb(255 255 255 / 0.038);
  --card-grid-line: rgb(255 255 255 / 0.09);

  --danger: #ff7d97;
  --danger-text: #ffc6d2;
  --danger-fill: rgb(255 125 151 / 0.08);
  --danger-stroke: rgb(255 125 151 / 0.42);
  --danger-ring: rgb(255 125 151 / 0.16);

  --field-stroke: rgb(255 255 255 / 0.2);
  --field-stroke-hover: rgb(255 255 255 / 0.3);

  --segment-track: rgb(0 0 0 / 0.28);
  --segment-track-stroke: rgb(255 255 255 / 0.1);
  --segment-track-shadow: rgb(0 0 0 / 0.35);
  --segment-thumb: rgb(255 255 255 / 0.14);
  --segment-thumb-stroke: rgb(255 255 255 / 0.16);
  --segment-thumb-shadow: 0 1px 2px rgb(0 0 0 / 0.35), inset 0 1px 0 rgb(255 255 255 / 0.08);

  --glass-fill: rgb(255 255 255 / 0.06);
  --glass-fill-strong: rgb(255 255 255 / 0.09);
  --glass-fill-soft: rgb(255 255 255 / 0.05);
  --glass-hairline: rgb(255 255 255 / 0.14);
  --pill-hairline: rgb(255 255 255 / 0.06);
  --glass-shadow: 0 1px 0 rgb(255 255 255 / 0.04) inset, 0 18px 40px -24px rgb(0 0 0 / 0.6);

  --bloom-wash:
    radial-gradient(
      ellipse 58% 62% at 68% 12%,
      rgb(101 125 231 / 0.28),
      rgb(74 78 169 / 0.22) 40%,
      rgb(98 76 194 / 0.16) 68%,
      rgb(98 76 194 / 0) 100%
    );
  --door-fill: linear-gradient(135deg, #5a86e0 0%, #4470d0 50%, #3a60c0 100%);
  --door-glow: 0 8px 22px -10px rgb(92 141 231 / 0.5), inset 0 1px 0 rgb(255 255 255 / 0.2);
  --door-glow-hover: 0 10px 26px -10px rgb(92 141 231 / 0.6), inset 0 1px 0 rgb(255 255 255 / 0.28);
  --door-glow-press: 0 5px 16px -8px rgb(92 141 231 / 0.5), inset 0 1px 3px rgb(5 10 28 / 0.22);
  --shimmer: linear-gradient(100deg, #8fb1f2 0%, #c3d4fa 35%, #7ee7ff 70%, #8fb1f2 100%);

  --code-base: #07091c;
  --header-fill: rgb(15 17 41 / 0.7);
}

/* 3. Base
   ========================================================================== */

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1rem);
  color-scheme: light;
}

html.quiet-dark {
  color-scheme: dark;
}

/* isolation gives the bloom (body::before, z-index -1) a stacking context above the body's own background */
body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: clip;
  background-color: var(--quiet-background-color);
}

main,
.main-content {
  flex: 1;
}

img {
  max-width: 100%;
  height: auto;
}

/* Text links turn the accent color on hover. Buttons and navigation define their own hover states later in this file. */
a {
  transition:
    color var(--duration) var(--ease),
    text-decoration-color var(--duration) var(--ease);
}

a:not(.quiet-button):hover {
  color: var(--accent-text);
  text-decoration-color: var(--accent);
}

:focus-visible {
  outline: var(--quiet-focus-ring);
  outline-offset: var(--quiet-focus-offset);
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  border-radius: var(--quiet-border-radius-pill);
  background: var(--quiet-paper-color);
  color: var(--quiet-text-body);
  box-shadow: var(--glass-shadow);

  &:focus {
    top: 0.75rem;
  }
}

/* 4. Type
   ========================================================================== */

/* Cal Sans for h1–h3 only. Display is tight tracking and short leading. */
h1,
h2,
h3,
.quiet-h1,
.quiet-h2,
.quiet-h3 {
  font-family: var(--quiet-font-family-heading);
  font-weight: 600;
  letter-spacing: var(--display-tracking);
  line-height: 1.08;
  color: var(--ink);
}

h1,
.quiet-h1 {
  font-size: clamp(2.5rem, 5.6vw, 4.25rem);
  line-height: 1.02;
}

h2,
.quiet-h2 {
  font-size: clamp(1.875rem, 3.6vw, 2.75rem);
}

h3,
.quiet-h3 {
  font-size: clamp(1.375rem, 2.2vw, 1.625rem);
  line-height: 1.15;
}

/* Below ~22px, headings switch to the system face */
h4,
h5,
h6,
.quiet-h4,
.quiet-h5,
.quiet-h6 {
  font-family: var(--quiet-font-family);
  font-weight: var(--quiet-font-weight-semibold);
  letter-spacing: -0.005em;
  line-height: 1.3;
  color: var(--ink);
}

h4,
.quiet-h4 {
  font-size: 1.1875rem;
}

h5,
.quiet-h5 {
  font-size: 1.0625rem;
}

h6,
.quiet-h6 {
  font-size: 0.9375rem;
}

/* One shimmered word per Cal Sans line, at most */
.shimmer {
  background: var(--shimmer);
  background-size: 220% 100%;
  background-position: 0% 50%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 14s ease-in-out infinite alternate;
}

@keyframes shimmer {
  to {
    background-position: 100% 50%;
  }
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  margin: 0 0 1.25rem;
  font-size: 0.8125rem;
  font-weight: var(--quiet-font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--quiet-text-muted);
}

/* A live dot: a ring ripples out from the center, fades away, and starts again. Under reduced motion the ring is
   hidden and the dot keeps a faint static halo. */
.eyebrow-dot {
  position: relative;
  flex: none;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 16%, transparent);

  &::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--accent);
    opacity: 0;
    animation: ripple 2.8s cubic-bezier(0.2, 0.6, 0.35, 1) infinite;
  }
}

@keyframes ripple {
  0% {
    scale: 1;
    opacity: 0.55;
  }

  70%,
  100% {
    scale: 3.4;
    opacity: 0;
  }
}

/* A highlighter swipe in the accent color, with uneven hand-drawn edges. <mark> is plain HTML, so editors can use it
   inside content regions. Code inside a mark drops its own background so the swipe shows through. */
mark {
  padding: 0.05em 0.3em;
  margin-inline: -0.1em;
  border-radius: 0.6em 0.25em 0.5em 0.3em;
  background:
    linear-gradient(
      100deg,
      transparent 0.5%,
      color-mix(in oklab, var(--accent) calc(42% * var(--accent-strength)), transparent) 2%,
      color-mix(in oklab, var(--accent) calc(30% * var(--accent-strength)), transparent) 6%,
      color-mix(in oklab, var(--accent) calc(24% * var(--accent-strength)), transparent) 94%,
      color-mix(in oklab, var(--accent) calc(40% * var(--accent-strength)), transparent) 97.5%,
      transparent 99.5%
    ),
    linear-gradient(183deg, transparent, color-mix(in oklab, var(--accent) calc(18% * var(--accent-strength)), transparent) 8%, transparent 16%);
  color: inherit;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;

  & code {
    background: transparent;
    padding: 0;
  }
}

/* A hand-drawn underline for one short phrase, in the logo's orange. It's a plain span, so it survives inside content
   regions, where the editor strips custom elements like <quiet-underline>. */
.scribble {
  position: relative;
  white-space: nowrap;

  &::after {
    content: '';
    position: absolute;
    left: -0.1em;
    right: -0.1em;
    bottom: -0.2em;
    height: 0.4em;
    background: var(--accent);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12' preserveAspectRatio='none'%3E%3Cpath d='M3 8.6C44 4.4 91 3.1 139 4.9c23 .9 41 2.1 58 3.7' fill='none' stroke='%23000' stroke-width='3.4' stroke-linecap='round'/%3E%3C/svg%3E")
      center / 100% 100% no-repeat;
    pointer-events: none;
  }
}

.kicker {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  font-weight: var(--quiet-font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--signal);
}

.lede,
.lead,
.lead-2 {
  max-width: 40rem;
  font-size: clamp(1.125rem, 1.6vw, 1.25rem);
  line-height: 1.55;
  color: var(--quiet-text-muted);

  & p {
    margin: 0;
  }

  & p + p {
    margin-top: 0.5em;
  }
}

.muted,
.opacity-90 {
  color: var(--quiet-text-muted);
}

.center,
.text-center {
  text-align: center;

  & .lede,
  & .lead,
  & .lead-2 {
    margin-inline: auto;
  }
}

/* Code blocks are a flat dark slab in both themes. Syntax colors are painted by MicroLighter (page.js) through the CSS
   Custom Highlight API, so the markup inside content regions never changes. The palette leans on brand blue and orchid,
   with the logo's orange and green as warm complements. Every token color clears 4.5:1 on the slab. */
:root {
  --syntax-foreground: #e7e7fe;
  --syntax-comment: #9395c1;
  --syntax-punctuation: #a0a1cb;
  --syntax-tag: #8fb1f2; /* periwinkle, from the brand blue */
  --syntax-attribute: #7ee7ff; /* cyan */
  --syntax-string: #f7b98b; /* apricot, from the logo's orange */
  --syntax-keyword: #b3a4ff; /* orchid */
  --syntax-function: #d3c8ff; /* pale orchid */
  --syntax-constant: #9fdb92; /* sage, from the logo's green */
  --syntax-type: #7ee7ff;
  --syntax-variable: #ffd28f; /* honey */
  --syntax-selector: #8fb1f2;
  --syntax-inserted: #9fdb92;
  --syntax-deleted: #ff9bb3;
}

pre {
  background: var(--code-base);
  color: var(--syntax-foreground);
  border: 1px solid rgb(255 255 255 / 0.08);
  border-radius: var(--radius-glass-sm);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05);
  padding: 1.125rem 1.25rem;
  overflow: auto;
  font-size: 0.875rem;
  line-height: 1.65;

  & code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: inherit;
  }

  &::selection,
  & ::selection {
    background: rgb(92 141 231 / 0.55);
    color: #fff;
  }

  /* Plain text, like a prompt to paste into an agent, wraps so every word is visible without scrolling sideways */
  & code:is(.language-text, .language-prompt) {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }
}

/* Copy buttons. page.js wraps each code block in .code-block and adds the button to its top-right corner, outside the
   scrolling <pre> so it stays put when long lines scroll sideways. */
.code-block {
  position: relative;

  & > pre {
    padding-inline-end: 3.25rem;
  }
}

.code-copy {
  position: absolute;
  inset-block-start: 0.625rem;
  inset-inline-end: 0.625rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: none;
  border-radius: 0.5rem;
  /* The slab's own color, with a soft halo of it and a solid strip out to the slab's edge, so code that scrolls sideways
     fades out under the button */
  background: var(--code-base);
  box-shadow:
    0.5625rem 0 0 var(--code-base),
    0 0 0.5rem 0.375rem var(--code-base);
  color: var(--syntax-comment);
  cursor: pointer;
  transition:
    background 0.15s,
    color 0.15s;

  & svg {
    width: 1.125rem;
    height: 1.125rem;
  }

  &:hover {
    background: color-mix(in oklab, var(--code-base), white 8%);
    color: var(--syntax-foreground);
  }

  &:focus-visible {
    outline: 2px solid var(--syntax-tag);
    outline-offset: 1px;
  }

  &.is-copied {
    color: var(--syntax-constant);
  }
}

/* Prompts are words for an agent, so they keep the dark slab but use the body font, under a small "Prompt" label. Mark
   one with <code class="language-prompt">, which survives the editor where a class on the <pre> wouldn't. Line breaks
   are kept as written. */
pre:has(> code.language-prompt) {
  position: relative;
  /* Lines the label and robot up with the center of the copy button */
  padding-block-start: 1.4375rem;
  font-family: var(--quiet-font-family);
  font-size: 1rem;
  line-height: 1.6;

  /* The copy button shares the label's line, so the text below can run the full width */
  .code-block > & {
    padding-inline-end: 1.25rem;
  }

  &::before {
    content: 'Prompt';
    display: block;
    padding-inline-start: 1.375rem;
    line-height: 1rem;
    margin-block-end: 0.5rem;
    font-size: 0.75rem;
    font-weight: var(--quiet-font-weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--syntax-comment);
  }

  /* A small robot in the accent color, left of the label: Tabler's robot icon as a mask, so it takes any color */
  &::after {
    content: '';
    position: absolute;
    inset-block-start: 1.4375rem;
    inset-inline-start: 1.25rem;
    width: 1rem;
    height: 1rem;
    background: var(--accent);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 6a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v4a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -4'/%3E%3Cpath d='M12 2v2'/%3E%3Cpath d='M9 12v9'/%3E%3Cpath d='M15 12v9'/%3E%3Cpath d='M5 16l4 -2'/%3E%3Cpath d='M15 14l4 2'/%3E%3Cpath d='M9 18h6'/%3E%3Cpath d='M10 8v.01'/%3E%3Cpath d='M14 8v.01'/%3E%3C/svg%3E") center / contain no-repeat;
  }

  & code {
    font-family: inherit;
  }
}

.code-copy-status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

::highlight(comment),
::highlight(quote) {
  color: var(--syntax-comment);
}

::highlight(operator),
::highlight(punctuation) {
  color: var(--syntax-punctuation);
}

::highlight(tag) {
  color: var(--syntax-tag);
}

::highlight(property),
::highlight(key),
::highlight(attribute-name) {
  color: var(--syntax-attribute);
}

::highlight(string),
::highlight(regexp),
::highlight(attribute-value),
::highlight(link),
::highlight(raw) {
  color: var(--syntax-string);
}

::highlight(keyword),
::highlight(storage),
::highlight(at-rule),
::highlight(doctype),
::highlight(important),
::highlight(section) {
  color: var(--syntax-keyword);
}

::highlight(function),
::highlight(decorator),
::highlight(animation) {
  color: var(--syntax-function);
}

::highlight(numeric),
::highlight(boolean),
::highlight(constant),
::highlight(symbol),
::highlight(character-entity),
::highlight(anchor),
::highlight(entity) {
  color: var(--syntax-constant);
}

::highlight(type),
::highlight(support) {
  color: var(--syntax-type);
}

::highlight(variable),
::highlight(interpolation) {
  color: var(--syntax-variable);
}

::highlight(selector) {
  color: var(--syntax-selector);
}

::highlight(inserted) {
  color: var(--syntax-inserted);
}

::highlight(deleted) {
  color: var(--syntax-deleted);
}

hr {
  border-color: var(--glass-hairline);
}

/* 5. Atmosphere
   ========================================================================== */

/* One off-center bloom per page, behind everything. It's painted inside a full-width box at the top of the page, so it
   can never cause horizontal scrolling, and it drifts a little over 40 seconds. */
body::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: min(72rem, 140vh);
  background: var(--bloom-wash);
  pointer-events: none;
  animation: drift 40s ease-in-out infinite alternate;
}

@keyframes drift {
  to {
    translate: 0 1.5rem;
  }
}

/* A faint blueprint grid: 24px cells with a stronger line every 120px, centered so it lines up the same at every width.
   It enters from the top of each page and from the bottom of the footer, fading out partway in both places. */
:root {
  --blueprint:
    linear-gradient(to right, var(--grid-line-major) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line-major) 1px, transparent 1px),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  --blueprint-size:
    120px 120px,
    120px 120px,
    24px 24px,
    24px 24px;
}

/* From the top of the page, over the bloom and behind all content */
body::after {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  height: 36rem;
  background-image: var(--blueprint);
  background-size: var(--blueprint-size);
  background-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, #000, rgb(0 0 0 / 0.55) 45%, transparent);
  mask-image: linear-gradient(to bottom, #000, rgb(0 0 0 / 0.55) 45%, transparent);
  pointer-events: none;
}

/* Glass is frost: a translucent fill, a hairline, and a blur */
.glass,
.card,
.feature-card,
.price-card,
.testimonial,
.auth-card,
.blog-feature,
.alert {
  background: var(--glass-fill);
  border: 1px solid var(--glass-hairline);
  border-radius: var(--radius-glass);
  box-shadow: var(--glass-shadow);
  -webkit-backdrop-filter: blur(18px) saturate(1.15);
  backdrop-filter: blur(18px) saturate(1.15);
}

.card,
.feature-card,
.testimonial {
  padding: clamp(1.5rem, 3vw, 2rem);

  & > :first-child {
    margin-top: 0;
  }

  & > :last-child {
    margin-bottom: 0;
  }
}

/* 6. Controls
   ========================================================================== */

/* Buttons use Restyle's classes: <a class="quiet-button quiet-pill">. Every control is a system-UI pill. */
button,
a.quiet-button {
  font-family: var(--quiet-font-family);
  border-radius: var(--quiet-border-radius-pill);
  transition:
    translate var(--duration) var(--ease),
    scale var(--duration) var(--ease),
    background-color var(--duration) var(--ease),
    border-color var(--duration) var(--ease),
    box-shadow var(--duration) var(--ease),
    color var(--duration) var(--ease);
}

a.quiet-button {
  display: inline-flex;
  line-height: 1;
}

/* Secondary: a frosted pill. The billing toggle's labels and code copy buttons opt out and paint themselves. */
button:not(.quiet-primary, .quiet-destructive, .quiet-plain, .billing-toggle *, .code-copy),
a.quiet-button:not(.quiet-primary, .quiet-destructive, .quiet-plain) {
  background: var(--glass-fill);
  border: 1px solid var(--glass-hairline);
  color: var(--ink);

  @media (hover: hover) {
    &:hover:not(:disabled, .quiet-disabled) {
      background: var(--glass-fill-strong);
      box-shadow: var(--glass-shadow);
    }
  }
}

/* The door: every call to action. Deep brand-blue gradient, white label, and a glow. It scales from its center, so it
   never appears to shift: hover grows it a little and brightens its glow, a press eases it back to its resting size
   with the glow drawn in, and letting go returns it to the hover size. One curve runs all three, so they read as one
   motion. */
button.quiet-primary,
a.quiet-button.quiet-primary {
  transform-origin: 50% 50%;
  background: var(--door-fill);
  color: var(--door-text);
  font-weight: 600;
  box-shadow: var(--door-glow);
  transition:
    scale var(--duration-door) var(--ease-door),
    box-shadow var(--duration-door) var(--ease-door),
    filter var(--duration-door) var(--ease-door);

  @media (hover: hover) {
    &:hover:not(:disabled, .quiet-disabled) {
      background: var(--door-fill);
      color: var(--door-text);
      box-shadow: var(--door-glow-hover);
      scale: var(--grow);
    }
  }

  /* Restyle nudges pressed buttons down; the door stays put and gives a little instead */
  &:active:not(:disabled, .quiet-disabled) {
    translate: none;
    scale: 1;
    box-shadow: var(--door-glow-press);
    filter: brightness(0.98);
    transition-duration: var(--duration-press);
  }
}

/* Full-width doors grow much less, so every door moves by about the same few pixels */
:is(.auth-split, .price-card, .cta-form) :is(button, a.quiet-button).quiet-primary:hover:not(:disabled, .quiet-disabled) {
  scale: var(--grow-wide);
}

/* Plain: a text-only pill for low-emphasis actions like "Login" */
button.quiet-plain,
a.quiet-button.quiet-plain {
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink);

  @media (hover: hover) {
    &:hover {
      background: var(--glass-fill);
      border-color: var(--glass-hairline);
    }
  }
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.center .button-row {
  justify-content: center;
}

/* Forms: Restyle does the work; inputs sit on glass */
input:not([type='checkbox'], [type='radio'], [type='range'], [type='color']),
select,
textarea {
  background-color: var(--glass-fill-strong);
  border-color: var(--field-stroke);
  color: var(--ink);

  @media (hover: hover) {
    &:hover:not(:focus, :disabled) {
      border-color: var(--field-stroke-hover);
    }
  }

  &:focus {
    border-color: color-mix(in oklab, var(--signal) 60%, transparent);
  }
}

.form-group {
  margin-bottom: 1rem;
}

.form-control {
  width: 100%;
}

.is-invalid {
  border-color: var(--danger-stroke) !important;
  box-shadow: 0 0 0 3px var(--danger-ring);
}

/* Form errors: a rose tint with a hairline and a small alert icon, tuned per theme to sit well against navy */
.form-popup {
  display: none;
  gap: 0.625rem;
  align-items: flex-start;
  margin: 0.75rem 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--danger-stroke);
  border-radius: var(--radius-glass-sm);
  background: var(--danger-fill);
  color: var(--danger-text);
  font-size: 0.9375rem;
  line-height: 1.5;

  &.show {
    display: flex;
  }

  &::before {
    content: '';
    flex: none;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.1em;
    background: var(--danger);
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0'/%3E%3Cpath d='M12 8v4'/%3E%3Cpath d='M12 16h.01'/%3E%3C/svg%3E")
      center / contain no-repeat;
  }

  & p {
    margin: 0;
  }
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  max-width: none;
  font-size: 0.9375rem;
  font-weight: var(--quiet-font-weight-normal);
  line-height: 1.4;

  & input {
    flex: none;
    margin: 0;
  }
}

/* 7. Layout
   ========================================================================== */

.container {
  width: min(100% - 2rem, var(--container));
  margin-inline: auto;
}

.container-narrow {
  width: min(100% - 2rem, var(--container-narrow));
  margin-inline: auto;
}

.section {
  padding-block: var(--section-space);
}

.section-tight {
  padding-block: calc(var(--section-space) / 2);
}

/* Right under a page hero, a plain section has no band edge to set it apart, so the hero's own space is enough */
.page-hero + .section:not(.section-muted) {
  padding-top: calc(var(--section-space) / 2);
}

/* A muted section is a calm band of mist; it isn't a second bloom */
.section-muted {
  background: color-mix(in oklab, var(--mist) 55%, transparent);
  border-block: 1px solid var(--glass-hairline);
}

.section-header {
  max-width: 44rem;
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);

  & h2 {
    margin: 0 0 1rem;
  }

  & hr {
    display: none;
  }

  & p:last-child {
    margin-bottom: 0;
  }
}

.section-header.center,
.center > .section-header {
  margin-inline: auto;
}

.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;

  & + .split {
    margin-top: clamp(4rem, 9vw, 7rem);
  }

  &.is-reverse > .split-media {
    order: -1;
  }

  & :is(h2, h3) {
    margin: 0 0 1rem;
  }
}

.grid-2,
.grid-3,
.feature-grid,
.faq-grid {
  display: grid;
  gap: 1.25rem;
}

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

.grid-3,
.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.faq-grid {
  gap: 2rem 3rem;

  & :is(h3, h4, h5) {
    margin: 0 0 0.5rem;
    font-family: var(--quiet-font-family);
    font-size: 1.0625rem;
    font-weight: var(--quiet-font-weight-semibold);
    letter-spacing: 0;
    line-height: 1.35;
  }
}

/* Screenshots sit in a glass frame. The window dots are quiet, not traffic lights. */
.media-frame {
  overflow: hidden;
  padding: 0;
  background: var(--glass-fill);
  border: 1px solid var(--glass-hairline);
  border-radius: var(--radius-glass);
  box-shadow: var(--glass-shadow);

  & img {
    display: block;
    width: 100%;
    border-radius: 0;
  }
}

.media-frame-bar {
  display: flex;
  gap: 0.375rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--glass-hairline);

  & i {
    width: 0.5625rem;
    height: 0.5625rem;
    border-radius: 50%;
    background: color-mix(in oklab, var(--ink) 18%, transparent);
  }
}

/* Framed images sit flush under the browser bar; the frame clips their bottom corners */
.split-media:not(.media-frame) > img {
  display: block;
  width: 100%;
  border-radius: var(--radius-glass);
}

/* 8. Site header
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-fill);
  border-bottom: 1px solid var(--glass-hairline);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--header-height);
}

.brand {
  display: flex;
  align-items: center;
  flex: none;
}

.wordmark {
  display: block;
  width: auto;
  height: 2.5rem;
}

.header-panel {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.125rem;

  & a {
    padding: 0.4375rem 0.875rem;
    border: 1px solid transparent;
    border-radius: var(--quiet-border-radius-pill);
    color: var(--quiet-text-muted);
    font-size: 0.9375rem;
    font-weight: var(--quiet-font-weight-semibold);
    text-decoration: none;
    white-space: nowrap;
    transition:
      color var(--duration) var(--ease),
      background-color var(--duration) var(--ease);

    &:hover,
    &.is-current {
      color: var(--ink);
      background: var(--glass-fill);
      border-color: var(--pill-hairline);
    }
  }
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;

  & .quiet-button {
    min-height: 2.5rem;
    font-size: 0.9375rem;
  }
}

/* The theme toggle is a bare icon: no fill, no border */
button.theme-toggle {
  background: transparent;
  border-color: transparent;

  @media (hover: hover) {
    &:hover {
      background: transparent;
      border-color: transparent;
      color: var(--ink);
    }
  }
}

button.theme-toggle,
button.nav-toggle {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  min-height: 2.5rem;
  height: 2.5rem;
  padding: 0;
  color: var(--quiet-text-muted);

  & svg {
    width: 1.125rem;
    height: 1.125rem;
  }
}

button.nav-toggle {
  display: none;
  position: relative;

  /* All three lines are centered in the button, then the outer two are pushed apart. Centering this way keeps the
     icon aligned regardless of the button's border. */
  & span {
    position: absolute;
    top: calc(50% - 0.75px);
    left: 0.75rem;
    right: 0.75rem;
    height: 1.5px;
    background: currentColor;
    border-radius: 1px;
    transition:
      translate var(--duration) var(--ease),
      rotate var(--duration) var(--ease),
      opacity var(--duration) var(--ease);
  }

  & span:nth-child(1) {
    translate: 0 -0.34375rem;
  }

  & span:nth-child(3) {
    translate: 0 0.34375rem;
  }
}

.site-header.is-open .nav-toggle {
  & span:nth-child(1) {
    translate: 0 0;
    rotate: 45deg;
  }

  & span:nth-child(2) {
    opacity: 0;
  }

  & span:nth-child(3) {
    translate: 0 0;
    rotate: -45deg;
  }
}

/* 9. Site footer
   ========================================================================== */

.site-footer {
  position: relative;
  isolation: isolate;
  padding-block: 4rem 3rem;
  border-top: 1px solid var(--glass-hairline);
  background: color-mix(in oklab, var(--mist) 50%, transparent);
  font-size: 0.9375rem;
}

/* The blueprint grid again, rising from the bottom edge of the footer and fading upward */
.site-footer::before,
.cta-band > .container::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: var(--blueprint);
  background-size: var(--blueprint-size);
  background-position: center bottom;
  -webkit-mask-image: linear-gradient(to top, #000, rgb(0 0 0 / 0.55) 45%, transparent);
  mask-image: linear-gradient(to top, #000, rgb(0 0 0 / 0.55) 45%, transparent);
  pointer-events: none;
}

/* In the CTA panel the grid comes in from the top edge instead */
.cta-band > .container::before {
  background-position: center top;
  -webkit-mask-image: linear-gradient(to bottom, #000, rgb(0 0 0 / 0.55) 45%, transparent);
  mask-image: linear-gradient(to bottom, #000, rgb(0 0 0 / 0.55) 45%, transparent);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 2fr;
  gap: 3rem;
}

.footer-brand {
  & .wordmark {
    height: 2.5rem;
    margin-bottom: 1.25rem;
  }

  & p {
    max-width: 26rem;
    color: var(--quiet-text-muted);
  }
}

.footer-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;

  & a {
    display: block;
    padding-block: 0.3125rem;
    color: var(--quiet-text-muted);
    text-decoration: none;

    &:hover {
      color: var(--ink);
    }
  }
}

.social {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem 0;

  & a {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--glass-hairline);
    border-radius: 50%;
    background: var(--glass-fill);
    color: var(--quiet-text-muted);

    &:hover {
      color: var(--ink);
      background: var(--glass-fill-strong);
    }
  }

  & svg {
    width: 1rem;
    height: 1rem;
  }
}

.legal {
  display: block;
  margin-top: 1rem;
  color: var(--ink-faint);
  font-size: 0.8125rem;
}

/* 10. Page patterns
   ========================================================================== */

/* Promise */
.hero {
  padding-block: clamp(4rem, 10vw, 8rem) clamp(3rem, 6vw, 5rem);
}

.hero-copy {
  max-width: 48rem;

  & h1 {
    margin: 0 0 1.5rem;
  }

  & .button-row {
    margin-top: 2.25rem;
  }
}

/* One quiet line under the hero's buttons that answers "what happens when I sign up?" */
.hero-note {
  margin: 1rem 0 0;
  font-size: 0.9375rem;
  color: var(--quiet-text-muted);
}

.hero-media {
  margin-top: clamp(3rem, 7vw, 5rem);
}

/* On desktop the screenshot sits beside the copy and reaches into the right gutter, up to 10rem, but always stops
   2rem short of the window's edge */
@media (min-width: 961px) {
  .hero > .container {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: clamp(3rem, 5vw, 4.5rem);
    align-items: center;
  }

  .hero-media {
    width: calc(100% + clamp(0rem, (100vw - var(--container)) / 2 - 2rem, 10rem));
    margin-top: 0;
  }
}

.page-hero {
  padding-block: clamp(3.5rem, 8vw, 6rem) clamp(1.5rem, 4vw, 3rem);

  & h1 {
    margin: 0 0 1rem;
  }

  & .button-row {
    margin-top: 2.25rem;
  }
}

/* Proof */
.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  text-align: center;
}

.stat-value {
  margin: 0 0 0.375rem;
  font-family: var(--quiet-font-family-heading);
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  letter-spacing: var(--display-tracking);
  line-height: 1;
  color: var(--ink);
}

.stat-label {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: var(--quiet-font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--quiet-text-muted);
}

/* A testimonial has no photo, so the opening quote mark is the picture: large, in the heading face, in brand blue
   at half strength so it decorates without signaling. The attribution sits at the bottom of every card so a row of
   them lines up. */
.testimonial {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.quote {
  position: relative;
  margin: 0 0 1.5rem;
  padding: 2.5rem 0 0;
  border: 0;
  background: none;
  font-style: normal;
  font-size: 1.1875rem;
  line-height: 1.6;
  color: var(--ink);
  text-wrap: pretty;

  &::before {
    content: '\201C';
    position: absolute;
    top: -0.375rem;
    left: -0.1875rem;
    font-family: var(--quiet-font-family-heading);
    font-size: 4.5rem;
    line-height: 1;
    color: var(--brand);
    opacity: 0.5;
    pointer-events: none;
  }
}

.stars {
  margin-bottom: 0.75rem;
  color: var(--ink-faint);
  font-size: 0.875rem;
  letter-spacing: 0.15em;
}

/* Name, then role, after a short rule where a photo would go */
.person {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.625rem;
  margin-top: auto;
  font-size: 0.9375rem;

  &::before {
    content: '';
    width: 1.25rem;
    height: 1px;
    background: var(--ink-faint);
    opacity: 0.6;
  }

  & strong {
    color: var(--ink);
  }

  & small {
    font-size: inherit;
    color: var(--quiet-text-muted);
  }
}

.feature-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--glass-hairline);
  border-radius: 0.75rem;
  background: var(--glass-fill-strong);
  color: var(--signal);

  & svg {
    width: 1.25rem;
    height: 1.25rem;
  }
}

/* Icons inside content regions are <img> files, because the editor strips inline <svg> from regions. Each file is a
   complete tile (a tinted rounded square plus the icon in one brand color), so the image needs no frame of its own. */
img.feature-icon {
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

/* Cards in a row share a height, so a closing "More about…" link sits on the same line in each of them */
.feature-card {
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;

  /* A corner of the page's blueprint grid, fading in toward the bottom-right, where cards usually have space to spare.
     Its cells are the icon's size, and its lines meet at the padding edges. */
  &::before {
    --cell: 2.75rem;
    --pad: clamp(1.5rem, 3vw, 2rem);
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    background-image:
      linear-gradient(to right, var(--card-grid-line) 1px, transparent 1px),
      linear-gradient(to bottom, var(--card-grid-line) 1px, transparent 1px);
    background-size: var(--cell) var(--cell);
    background-position: right var(--pad) bottom var(--pad);
    -webkit-mask-image: radial-gradient(circle at 100% 100%, #000, transparent 12rem);
    mask-image: radial-gradient(circle at 100% 100%, #000, transparent 12rem);
    pointer-events: none;
  }

  & > p:last-child:has(> a:only-child) {
    margin-top: auto;
  }

  & h3,
  & h4,
  & h5 {
    margin: 0 0 0.5rem;
    font-family: var(--quiet-font-family);
    font-size: 1.0625rem;
    font-weight: var(--quiet-font-weight-semibold);
    letter-spacing: 0;
    line-height: 1.3;
  }

  & p {
    color: var(--quiet-text-muted);
  }
}

/* Contact page: the aside is top-aligned with the form and its sign-off sits level with the form's bottom edge */
.contact-layout {
  align-items: stretch;

  & > aside {
    display: flex;
    flex-direction: column;
    gap: 2.25rem;
    padding-top: clamp(1.5rem, 3vw, 2rem);
  }

  & :is(h2, h3) {
    margin: 0 0 0.75rem;
  }

  & .social {
    margin: 0;
  }
}

/* A small sign-off: the logo mark beside a short line, like "Proudly built in Florida" */
.made-in {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  margin: auto 0 0;
  padding: 1.5rem 0 0;
  border: 0;
  border-top: 1px solid var(--glass-hairline);
  border-radius: 0;
  box-shadow: none;

  & img {
    width: 3rem;
    height: auto;
  }

  & figcaption {
    padding: 0;
  }
}

.step-index {
  margin: 0 0 0.5rem;
  font-family: var(--quiet-font-family-heading);
  font-size: 3rem;
  line-height: 1;
  color: color-mix(in oklab, var(--signal) 45%, transparent);
}

/* Ask. The CTA is a large glass panel; the door inside it is the brightest object. */
.cta-band {
  padding-block: var(--section-space);

  & > .container {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: clamp(2rem, 5vw, 3.5rem);
    text-align: center;
    background: var(--glass-fill);
    border: 1px solid var(--glass-hairline);
    border-radius: calc(var(--radius-glass) + 0.5rem);
    box-shadow: var(--glass-shadow);
    -webkit-backdrop-filter: blur(18px) saturate(1.15);
    backdrop-filter: blur(18px) saturate(1.15);
  }

  & h2,
  & h3 {
    margin: 0 0 1.125rem;
    font-size: clamp(1.625rem, 3vw, 2.25rem);
  }

  & p {
    margin-inline: auto;
    max-width: 36rem;
    color: var(--quiet-text-muted);
  }
}

.cta-note {
  margin: 1rem auto 0;
  font-size: 0.8125rem;
  color: var(--ink-faint);
}

.cta-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 0.75rem;
  margin-top: 2rem;
  text-align: left;

  & input {
    border-radius: var(--quiet-border-radius-pill);
    padding-inline: 1.125rem;
  }

  & .form-popup {
    grid-column: 1 / -1;

    /* Undo the CTA panel's centered, muted paragraphs so the message sits beside its icon in the error color */
    & p {
      max-width: none;
      margin: 0;
      color: inherit;
    }
  }
}

/* 11. Docs
   ========================================================================== */

.docs-layout {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
  padding-block: 1rem var(--section-space);
}

.page-hero:has(#docs-heading) {
  padding-block: clamp(2.5rem, 5vw, 3.5rem) 0;
}

#docs-heading {
  margin: 0;
  font-size: 0.8125rem;
  font-family: var(--quiet-font-family);
  font-weight: var(--quiet-font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--quiet-text-muted);
}

/* The sidebar moves with the page. When it's taller than the window, page.js adjusts its sticky offset as you scroll,
   so it follows the page in either direction and sticks once its top or bottom edge is in view. There's no separate
   scroll area, so one scroll moves everything. */
#docs-sidebar {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  padding: 1rem 0.5rem 1.5rem 0;

  & > .cms-repeatable + .cms-repeatable {
    margin-top: 1.5rem;
  }

  & .sidebar-title {
    margin: 0 0 0.5rem;
    padding-inline: 0.75rem;
    font-size: 0.75rem;
    font-weight: var(--quiet-font-weight-semibold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-faint);
  }

  & nav {
    display: flex;
    flex-direction: column;
    gap: 0.0625rem;
  }

  & a {
    padding: 0.25rem 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--quiet-border-radius-pill);
    color: var(--quiet-text-muted);
    font-size: 0.9375rem;
    line-height: 1.45;
    text-decoration: none;

    &:hover,
    &.is-current {
      color: var(--ink);
      background: var(--glass-fill);
      border-color: var(--pill-hairline);
    }
  }
}

.docs-article {
  min-width: 0;
  max-width: 46rem;

  & h1 {
    margin: 0 0 1.25rem;
    font-size: clamp(2.25rem, 4.5vw, 3rem);
    line-height: 1.05;
  }

  & h2 {
    margin-top: 3rem;
    font-size: clamp(1.5rem, 2.6vw, 1.875rem);
  }

  & h3 {
    margin-top: 2.25rem;
    font-size: 1.375rem;
  }

  & h4 {
    margin-top: 2rem;
  }

  & img {
    border: 1px solid var(--glass-hairline);
    border-radius: var(--radius-glass-sm);
  }

  & table {
    width: 100%;
    font-size: 0.9375rem;
  }

  & th {
    color: var(--quiet-text-muted);
    font-weight: var(--quiet-font-weight-semibold);
    text-align: start;
  }
}

/* Row labels line up with the first line of their cell. Long URLs and paths in table cells break instead of pushing the
   table past the edge of a phone. */
:is(.docs-article, .post-content) :is(td, th) {
  vertical-align: top;
  overflow-wrap: break-word;

  & code {
    overflow-wrap: anywhere;
  }
}

/* Callouts. The class names are kept because published pages and blocks already use them. */
.alert {
  margin-block: 1.5rem;
  padding: 1.125rem 1.25rem;
  border-radius: var(--radius-glass-sm);
  border-left-width: 3px;

  & > :first-child {
    margin-top: 0;
  }

  & > :last-child {
    margin-bottom: 0;
  }

  & .alert-heading,
  & :is(h2, h3, h4, h5) {
    margin: 0 0 0.375rem;
    font-family: var(--quiet-font-family);
    font-size: 0.9375rem;
    font-weight: var(--quiet-font-weight-semibold);
    letter-spacing: 0;
    line-height: 1.4;
  }
}

.alert-info {
  border-left-color: var(--signal);

  & .alert-heading,
  & :is(h2, h3, h4, h5) {
    color: var(--signal);
  }
}

.alert-warning {
  border-left-color: #d98a1e;

  & .alert-heading,
  & :is(h2, h3, h4, h5) {
    color: light-dark(#a8620b, #f2b45c);
  }
}

.alert-success {
  border-left-color: var(--quiet-constructive-fill-mid);

  & .alert-heading,
  & :is(h2, h3, h4, h5) {
    color: var(--quiet-constructive-text-colorful);
  }
}

/* API routes on the Developer API page: repeatable <details> on glass */
.docs-api-route {
  margin-bottom: 0.5rem;
  border: 1px solid var(--glass-hairline);
  border-radius: var(--radius-glass-sm);
  background: var(--glass-fill);

  & + .docs-api-route {
    margin-top: 0;
  }

  & summary {
    padding: 0.75rem 1rem;
    cursor: pointer;

    & > code:first-child {
      font-size: 0.875rem;
      overflow-wrap: anywhere;
    }

    & > :last-child {
      display: block;
      margin: 0.25rem 0 0;
      color: var(--quiet-text-muted);
    }
  }

  &[open] summary {
    border-bottom: 1px solid var(--glass-hairline);
  }
}

.docs-api-route__details {
  padding: 1rem 1.25rem;

  & > :first-child {
    margin-top: 0;
  }

  & ul p {
    margin-bottom: 0.25rem;
  }
}

/* 12. Blog
   ========================================================================== */

/* The index is organized by topic, not by date. The newest post is featured on top, three evergreen posts follow as
   cards, and every other post is a row in a topic list. */

/* The next section's own padding is enough space below the featured post */
.blog-featured-section {
  padding-bottom: 0;
}

/* Featured post: a wide glass panel with a picture of the post's subject beside the words */
.blog-feature {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: center;
  padding: clamp(1.5rem, 4vw, 2.75rem);

  & h2 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.75rem, 3.2vw, 2.375rem);
  }

  & .blog-feature-text > p:last-child {
    margin: 0;
    font-size: clamp(1.0625rem, 1.4vw, 1.1875rem);
    line-height: 1.55;
    color: var(--quiet-text-muted);
  }

  & pre {
    margin: 0;
  }
}

.blog-feature,
.blog-card,
.blog-row {
  & :is(h2, h3) a {
    color: var(--ink);
    text-decoration: none;
    transition: color var(--duration) var(--ease);
  }
}

/* The title's link stretches over its card or row, so the whole thing is clickable. Not in the editor, where the
   overlay would get in the way of editing. */
html:not(.is-cms) :is(.blog-feature, .blog-card, .blog-row) {
  position: relative;

  & :is(h2, h3) a::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
  }
}

.blog-card {
  transition: background-color var(--duration) var(--ease);
}

/* Topic sections: the heading sits in a column on the left and stays in view while its list scrolls by */
.blog-topics {
  display: grid;
  gap: clamp(3rem, 7vw, 5rem);
}

.blog-topic {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1.5rem clamp(2rem, 6vw, 5rem);
  align-items: start;
  scroll-margin-top: calc(var(--header-height) + 1.5rem);
}

.blog-topic-header {
  position: sticky;
  top: calc(var(--header-height) + 2rem);

  & h2 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.5rem, 2.4vw, 1.875rem);
  }

  & p {
    margin: 0;
    color: var(--quiet-text-muted);
  }
}

/* Rows are divided by hairlines instead of boxed, so a reader sees more posts at a glance */
.blog-list {
  border-top: 1px solid var(--glass-hairline);
}

.blog-row {
  position: relative;
  padding: 1.25rem 2.5rem 1.25rem 0;
  border-bottom: 1px solid var(--glass-hairline);

  & h3 {
    margin: 0 0 0.25rem;
    font-family: var(--quiet-font-family);
    font-size: 1.0625rem;
    font-weight: var(--quiet-font-weight-semibold);
    letter-spacing: 0;
    line-height: 1.35;
  }

  & p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.55;
    color: var(--quiet-text-muted);
  }

  /* An arrow fades in at the end of the row on hover */
  &::before {
    content: '→';
    position: absolute;
    top: 1.25rem;
    right: 0.25rem;
    color: var(--signal);
    opacity: 0;
    transition: opacity var(--duration) var(--ease);
  }
}

/* Older news: one line per post, title on the left and year on the right */
.blog-list-compact .blog-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.875rem 0;

  & h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: var(--quiet-font-weight-normal);
  }

  & p {
    flex: none;
    color: var(--ink-faint);
    font-variant-numeric: tabular-nums;
  }

  &::before {
    content: none;
  }
}

@media (hover: hover) {
  .blog-card:hover {
    background: var(--glass-fill-strong);
  }

  :is(.blog-feature, .blog-card, .blog-row):hover :is(h2, h3) a {
    color: var(--signal);
  }

  .blog-row:hover::before {
    opacity: 1;
  }
}

.post-header {
  max-width: var(--container-narrow);
  margin: 0 auto clamp(2rem, 5vw, 3.5rem);
  text-align: center;

  & h1,
  & h2 {
    margin: 0 0 1rem;
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    line-height: 1.05;
  }

  & p {
    margin: 0;
    color: var(--quiet-text-muted);
  }
}

.post-content {
  max-width: var(--container-narrow);
  margin-inline: auto;
  font-size: 1.0625rem;
  line-height: 1.7;

  & h2 {
    margin-top: 2.75rem;
    font-size: clamp(1.5rem, 2.8vw, 2rem);
  }

  & h3 {
    margin-top: 2.25rem;
    font-size: 1.375rem;
  }

  /* Editors can drop any image into a post, so figures and images get no frame of their own */
  & figure {
    margin-block: 1.5rem;
    margin-inline: 0;
    padding: 0;
    border: 0;
    box-shadow: none;

    & img {
      margin-block: 0;
    }
  }

  & figcaption {
    margin-top: 0.5rem;
    padding: 0;
    font-size: 0.875rem;
    color: var(--quiet-text-muted);
    text-align: center;
  }

  & img {
    display: block;
    margin-block: 1.5rem;
    border-radius: var(--radius-glass-sm);
  }
}

/* 13. Pricing
   ========================================================================== */

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
  align-items: stretch;
  max-width: 64rem;
  margin-inline: auto;

  /* Three plans side by side, then a single narrow column so a card never stretches across a phone */
  @media (max-width: 900px) {
    grid-template-columns: minmax(0, 1fr);
    max-width: 24rem;
  }
}

.price-card {
  display: flex;
  flex-direction: column;
  padding: clamp(1.5rem, 3vw, 2rem);

  & .quiet-button {
    margin-top: auto;
  }

    /* The secondary Sign up buttons get a firmer hairline than other frosted pills, so they read as buttons on glass */
  & a.quiet-button:not(.quiet-primary) {
    border-color: color-mix(in oklab, var(--ink) 22%, transparent);
  }

/* Missing features are faint, not red, so nothing competes with the door */
  & del {
    color: var(--ink-faint);
    text-decoration-color: currentColor;
  }
}

/* What a plan includes: one item per line with a hanging indent, so a long item wraps under its own first word
   instead of under the mark. Included items get a check in the signal color; missing ones get a faint dash. */
.price-features {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  font-size: 0.9375rem;

  & li {
    position: relative;
    padding-left: 1.5rem;
    margin-bottom: 0.5rem;
    list-style: none;
    line-height: 1.45;
    text-wrap: pretty;
  }

  & li::marker {
    content: '';
  }

  & li::before {
    content: '';
    position: absolute;
    top: 0.3em;
    left: 0;
    width: 1em;
    height: 1em;
    background-color: var(--signal);
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12l5 5L20 7"/></svg>')
      center / contain no-repeat;
  }

  /* Links here define terms, so they're quiet: ink with a faint underline, leaving the checkmarks to carry the blue */
  & a {
    color: inherit;
    text-decoration-color: color-mix(in oklab, currentColor 40%, transparent);
  }

  & li:has(> del)::before {
    background-color: var(--ink-faint);
    opacity: 0.6;
    mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.5" stroke-linecap="round"><path d="M6 12h12"/></svg>')
      center / contain no-repeat;
  }
}

/* "Every plan includes": a plain list in columns, so the free plan's value is easy to scan */
.plan-includes {
  max-width: 56rem;
  margin: 0 auto;
  padding-left: 1.25rem;
  columns: 3;
  column-gap: 3rem;

  & li {
    break-inside: avoid;
    margin-bottom: 0.625rem;
  }

  & li::marker {
    color: var(--signal);
  }

  @media (max-width: 960px) {
    columns: 2;
  }

  @media (max-width: 560px) {
    columns: 1;
  }
}

/* The featured plan earns a stronger hairline, not a louder fill */
.price-card.is-featured {
  background: var(--glass-fill-strong);
  border-color: color-mix(in oklab, var(--signal) 45%, var(--glass-hairline));
}

.price-plan {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0;
  font-size: 0.8125rem;
  font-weight: var(--quiet-font-weight-semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--quiet-text-muted);
}

/* The one plan we steer people toward. A tinted pill in the accent orange, like the scribble: it points, it never fills. */
.price-badge {
  position: relative;
  padding: 0.25rem 0.625rem;
  border: 1px solid color-mix(in oklab, var(--accent) 40%, transparent);
  border-radius: var(--quiet-border-radius-pill);
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  color: var(--accent-text);
  font-size: 0.6875rem;
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;

  /* The same slow ripple as the eyebrow dot, as a ring that spreads from the pill's edge and fades away */
  &::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    animation: badge-ripple 2.8s cubic-bezier(0.2, 0.6, 0.35, 1) infinite;
  }
}

@keyframes badge-ripple {
  0% {
    box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 45%, transparent);
  }

  70%,
  100% {
    box-shadow: 0 0 0 0.625rem color-mix(in oklab, var(--accent) 0%, transparent);
  }
}

.price-amount {
  margin: 0.75rem 0 1.25rem;
  font-family: var(--quiet-font-family-heading);
  font-size: 3rem;
  letter-spacing: var(--display-tracking);
  line-height: 1;
  color: var(--ink);

  & small {
    font-family: var(--quiet-font-family);
    font-size: 1rem;
    letter-spacing: 0;
    color: var(--quiet-text-muted);
  }
}

/* A segmented pill control: a recessed well with a raised thumb. It uses neutrals only, so it reads clearly without
   competing with the blue calls to action beside it. */
.billing-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 0.25rem;
  border: 1px solid var(--segment-track-stroke);
  border-radius: var(--quiet-border-radius-pill);
  background: var(--segment-track);
  box-shadow: inset 0 1px 2px var(--segment-track-shadow);

  /* One thumb slides between the two labels instead of each button lighting up in place. It sits under the
     Monthly label until the JS moves the active class; the HTML ships with Monthly active, so it needs no script.
     It moves as one solid piece on the site's settle curve: it gets going, then slows smoothly into place. */
  &::before {
    content: '';
    position: absolute;
    inset: 0.25rem auto 0.25rem 0.25rem;
    width: calc(50% - 0.25rem);
    border: 1px solid var(--segment-thumb-stroke);
    border-radius: var(--quiet-border-radius-pill);
    background: var(--segment-thumb);
    box-shadow: var(--segment-thumb-shadow);
    transition: translate 360ms var(--ease-settle);
  }

  &:has([data-period='yearly'].is-active)::before {
    translate: 100% 0;
  }

  /* The labels never paint anything themselves, in any state. Only the thumb moves. Hover and press are spelled out
     because the site's secondary-button rules would otherwise fill the label the instant it is clicked, before the
     thumb arrives, and Restyle would nudge it down a pixel while pressed. */
  & button,
  & button:hover:not(:disabled),
  & button:active:not(:disabled) {
    position: relative;
    min-height: 2.25rem;
    padding-inline: 1.125rem;
    border-color: transparent;
    background: transparent;
    box-shadow: none;
    translate: none;
    scale: none;
    font-size: 0.9375rem;
    transition: color 260ms ease;
  }

  & button {
    color: var(--quiet-text-muted);
  }

  & button.is-active {
    color: var(--ink);
  }
}

/* 14. Auth, error
   ========================================================================== */

.auth-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.auth-card {
  width: min(100%, 26rem);
  padding: clamp(1.75rem, 5vw, 2.5rem);

  /* The wordmark anchors the card, so it's larger here than in the header */
  & .wordmark {
    height: 3.5rem;
    max-width: 100%;
    margin: 0 auto 2rem;
  }

  & h1 {
    margin: 0 0 1.5rem;
    font-size: 1.75rem;
    text-align: center;
  }

  /* A line under the heading sits close to it and leaves room before the form */
  & h1 + p {
    margin: -0.75rem 0 1.75rem;
  }
}

.auth-split {
  display: grid;
  gap: 1.25rem;
  text-align: center;

  /* The gap does the spacing, and a door in a paragraph fills the card like a submit button does */
  & > p {
    margin: 0;
  }

  & > p > .quiet-button {
    width: 100%;
  }
}

.error-page {
  display: grid;
  place-items: center;
  min-height: calc(100vh - var(--header-height));
  padding: 3rem 1rem;
  text-align: center;
}

.error-code {
  margin: 0 0 0.5rem;
  font-family: var(--quiet-font-family-heading);
  font-size: clamp(5rem, 16vw, 9rem);
  letter-spacing: var(--display-tracking);
  line-height: 0.9;
  color: color-mix(in oklab, var(--signal) 55%, transparent);
}

/* 15. Legacy content classes
   Older pages and saved blocks still use these inside content regions. Keep them working; don't use them in new
   markup. See DESIGN.md.
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--quiet-form-control-height-md);
  padding-inline: 1.25em;
  border-radius: var(--quiet-border-radius-pill);
  font-weight: var(--quiet-font-weight-semibold);
  text-decoration: none;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin-inline: -0.75rem;

  & > [class*='col-'] {
    padding-inline: 0.75rem;
  }
}

[class*='col-'] {
  width: 100%;
}

@media (min-width: 768px) {
  .col-md-4 {
    width: 33.333%;
  }
  .col-md-6 {
    width: 50%;
  }
  .col-md-8 {
    width: 66.666%;
  }
  .col-md-10 {
    width: 83.333%;
  }
}

@media (min-width: 992px) {
  .col-lg-4 {
    width: 33.333%;
  }
  .col-lg-6 {
    width: 50%;
  }
  .col-lg-8 {
    width: 66.666%;
  }
}

.mx-auto {
  margin-inline: auto;
}

.w-100 {
  width: 100%;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mt-6 {
  margin-top: 1.5rem;
}

.mt-8 {
  margin-top: 2rem;
}

.mb-0 {
  margin-bottom: 0;
}

/* 16. Responsive
   ========================================================================== */

@media (max-width: 960px) {
  .split,
  .grid-2,
  .grid-3,
  .feature-grid,
  .faq-grid,
  .footer-grid,
  .docs-layout,
  .blog-feature,
  .blog-topic {
    grid-template-columns: minmax(0, 1fr);
  }

  .blog-topic-header {
    position: static;
  }

  /* Stacked, every image follows its own text, whichever side it sat on and whatever the markup order */
  .split > .split-media,
  .split.is-reverse > .split-media {
    order: 1;
  }

  #docs-sidebar {
    position: static;
    max-height: none;
    order: 2;
    padding-top: 2rem;
    border-top: 1px solid var(--glass-hairline);
  }

  .cta-form {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  button.nav-toggle {
    display: inline-grid;
  }

  .header-panel {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem;
    background: var(--quiet-background-color);
    border-bottom: 1px solid var(--glass-hairline);
    box-shadow: var(--glass-shadow);
  }

  .site-header.is-open .header-panel {
    display: flex;
  }

  .nav-links {
    flex-direction: column;
    align-items: stretch;
  }

  .header-actions {
    justify-content: flex-end;
  }
}

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

  .footer-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* 17. Motion
   ========================================================================== */

/* Theme switches. switchTheme() in page.js adds this class and clips the new snapshot to a circle that grows out of
   the toggle. The default crossfade is off so the old theme sits still underneath until the circle reaches it. */
:root.theme-transition::view-transition-old(root),
:root.theme-transition::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

:root.theme-transition::view-transition-new(root) {
  z-index: 1;
}

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

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }

  button.quiet-primary:is(:hover, :active),
  a.quiet-button.quiet-primary:is(:hover, :active) {
    scale: none !important;
    translate: none !important;
  }
}
