@import 'code-examples.css';
@import 'copy-code.css';
@import 'external-links.css';
@import 'highlight-code.css';
@import 'search.css';

/* Docs-specific variables */
:root {
  --docs-max-width: 1440px;
  --docs-header-height: 3.375rem;
  --docs-outline-width: 14rem;
  --docs-content-spacing: 5rem;
  --docs-header-z-index: 10;
  --docs-sidebar-z-index: 20;
  --docs-sidebar-width: 17rem;
  --docs-sidebar-speed: 250ms;
  --docs-logo-accent-color: var(--quiet-primary-fill-mid);
}

html.quiet-dark {
  --docs-logo-accent-color: color-mix(in oklab, var(--quiet-primary-fill-mid), white 9.5%);
}

/* Utility classes */
html[data-scroll-restoring] body {
  visibility: hidden;
}

.turbo-progress-bar {
  background-color: var(--quiet-primary-fill-mid);
}

.unstyled-list {
  margin-inline: 0;
  padding-inline: 0;

  li {
    margin-inline: 0;
    padding-inline: 0;
    list-style: none;
  }
}

@media screen and (min-width: 768px) {
  .two-columns {
    gap: 2rem;
    columns: 2;
  }
}

@media screen and (min-width: 768px) {
  .only-mobile {
    display: none !important;
  }
}

@media screen and (max-width: 767px) {
  .not-mobile {
    display: none !important;
  }
}

#skip-to-main {
  z-index: calc(var(--docs-header-z-index) + 1);
  position: fixed;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--quiet-border-radius-md);
  outline-offset: 0;
  background: var(--quiet-paper-color);
  box-shadow: 0 5px 20px rgb(0 0 0 / 0.125);
  text-decoration: none;
}

#skip-to-main:not(:focus) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  white-space: nowrap;
  /* Visually hidden */
  clip-path: inset(50%);
}

#header {
  display: flex;
  z-index: var(--docs-header-z-index);
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  justify-content: center;
  height: var(--docs-header-height);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background-color: color-mix(in oklab, transparent, var(--quiet-background-color) 85%);
  transition: 0.25s background-color ease;
}

/* Draw the underline as a separate element so we can use z-index */
#header::after {
  z-index: calc(var(--docs-header-z-index) + 1);
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  border-bottom: var(--quiet-border-style) var(--quiet-border-width) var(--quiet-neutral-stroke-softer);
  content: '';
  transition: 0.25s border-color ease;
}

/* Header groups */
.header-group {
  display: flex;
  position: relative;
  align-items: center;
  height: calc(var(--docs-header-height) / 2);
  line-height: calc(var(--docs-header-height) / 2);
}

.header-group:first-of-type {
  flex: 1 1 auto;
}

.header-group:not(:first-of-type) + .header-group {
  padding-inline-start: 1rem;
  border-left: var(--quiet-border-style) var(--quiet-border-width) var(--quiet-neutral-stroke-softer);
}

/* Splash page divider colors should match the background better */
.layout-splash:not(.scrolled-down) {
  .header-group:not(:first-of-type) + .header-group {
    border-left-color: color-mix(in oklab, var(--quiet-strident) 15%, transparent);
  }
}

.header-group-scrollable {
  display: flex;
  flex: 1 1 auto;
  height: var(--docs-header-height);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;

  quiet-scroller::part(content) {
    display: flex;
    flex-wrap: nowrap;
  }
}

/* Header logo */
#header-logo {
  flex: 0 0 auto;

  @media screen and (max-width: 959px) {
    margin-inline-start: 0.5rem;
  }
}

#header-logo a {
  display: inline-flex;
  align-items: center;
  justify-content: start;
  height: calc(var(--docs-header-height) - 1rem);
  color: inherit;
  text-decoration: none;
}

#header-logo img,
#header-logo svg {
  display: block;
  width: auto;
  height: calc(var(--docs-header-height) / 1.75);
  margin-inline-end: 0.25rem;
}

#header-logo svg.only-mobile {
  max-width: 2em;
  padding-block: 0.125rem;
}

/* Header group links */
@media screen and (min-width: 768px) {
  #header-group-links > :first-child {
    /* Allow header links to be scrollable and right aligned on larger screens */
    margin-inline-start: auto;
  }
}

#header-group-links a {
  height: var(--docs-header-height);
  padding-inline: 0.5rem;
  color: inherit;
  font-size: 0.875rem;
  line-height: var(--docs-header-height);
  text-decoration: none;
  white-space: nowrap;

  &:not(:last-child) {
    margin-inline-end: 0.5rem;
  }
}

#header-group-links a svg {
  width: 1.1em;
  height: 1.1em;
  color: deeppink;
  vertical-align: -3px;

  &:hover {
    animation: none;
  }
}

#header-group-links .with-heart {
  span {
    display: inline-block;
  }

  svg {
    animation: 0.8375s infinite heartbeat alternate ease;
    transition: 0.5s transform ease;
  }

  @media (hover: hover) {
    &:hover svg {
      transform: scaleX(-1);
      transition: 500ms transform ease;
    }
  }
}

@keyframes flip-x {
  0% {
    transform: scaleX(1);
  }
  90% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(-1);
  }
}

@keyframes heartbeat {
  from {
    scale: 0.9;
  }
  to {
    scale: 1.1;
  }
}

@media (hover: hover) {
  #header-group-links a:hover {
    color: var(--quiet-primary-text-colorful);
  }
}

#header-group-links a:focus-visible {
  outline-offset: calc(var(--quiet-focus-width) * -2 - var(--quiet-focus-offset));
}

#header-group-links .current {
  z-index: calc(var(--docs-header-z-index) + 2);
  position: relative;
  height: calc(var(--docs-header-height) - var(--quiet-border-width));
  border-bottom: var(--quiet-border-style) calc(var(--quiet-border-width) * 2) var(--quiet-primary-text-colorful);
  color: var(--quiet-primary-text-colorful);
  font-weight: var(--quiet-font-weight-semibold);
}

/* Header group buttons */
#header-group-buttons {
  flex: 0 0 auto;
}

#header-group-buttons a,
#header-group-buttons button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: calc(var(--docs-header-height) - 1rem);
  margin: 0;
  padding: 0 0.5rem;
  border: none;
  border-radius: 0;
  background: none;
  color: inherit;
  cursor: pointer;

  &:focus-visible {
    outline-offset: calc(var(--quiet-focus-width) * -1 - var(--quiet-focus-offset));
  }

  &:active {
    translate: none;
  }
}

#header-group-buttons quiet-icon {
  font-size: 1.25rem;

  /* Carets */
  &[name='chevron-down'] {
    font-size: 1em;
  }
}

#header-group-buttons a svg,
#header-group-buttons button svg {
  width: 1.25rem;
  height: 1.25rem;
}

@media (hover: hover) {
  #header-group-buttons a:hover svg,
  #header-group-buttons button:hover svg {
    color: var(--quiet-primary-text-colorful);
  }
}

/* Color picker dropdowns */
.color-picker {
  &::part(menu) {
    display: block;
    gap: 0.5rem;
    columns: 3;
  }

  quiet-dropdown-item {
    padding-inline: 0.5rem;
    padding-block: 0.25rem;
    font-size: 0.8375rem;
    text-transform: capitalize;

    &.current {
      background-color: var(--quiet-primary-fill-soft);
      font-weight: var(--quiet-font-weight-semibold);
    }
  }
}

.color-picker-swatch {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: var(--quiet-border-radius-sm);
}

#open-sidebar,
#close-sidebar {
  display: none;
  border-radius: var(--quiet-border-radius-md);
}

#navbar {
  display: flex;
  align-items: center;
  width: 100%;
  max-width: var(--docs-max-width);
  padding-inline: 1rem;
  gap: 1rem;

  @media screen and (max-width: 959px) {
    gap: 0.5rem;
  }
}

#body {
  display: grid;
  position: relative;
  grid-template-columns: auto;
  max-width: calc(var(--docs-max-width) - var(--docs-sidebar-width));
  height: 100%;
  min-height: 100dvh;
  margin-block-start: var(--docs-header-height);
  margin: 0 auto;
}

#sidebar {
  position: sticky;
  top: var(--docs-header-height);
  align-self: start;
  height: calc(100dvh - var(--docs-header-height));
  scrollbar-color: var(--quiet-neutral-fill-mid) transparent;
  scrollbar-width: thin;
  -webkit-text-size-adjust: 100%; /* prevent mobile Safari from showing larger text sometimes*/

  /* Bump the padding so focus rings and dots don't get clipped, then transform is back so it's visually aligned */
  padding-inline-start: calc(var(--quiet-focus-width) + var(--quiet-focus-offset) + 0.25rem);
  padding-inline-end: 2rem;
  padding-block: 3rem 2rem;
  overflow-x: hidden;
  overflow-y: auto;
  translate: calc(-1 * (var(--quiet-focus-width) + var(--quiet-focus-offset)) - 0.25rem);
  border-right: var(--quiet-border-style) var(--quiet-border-width) var(--quiet-neutral-stroke-softer);

  @media screen and (min-width: 1420px) {
    padding-inline: 1.5rem;
  }
}

#sidebar-meta {
  svg {
    display: block;
    max-width: 1.75rem;
    max-height: 1.75rem;
    margin-block-end: -0.33rem;
  }

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

#page {
  display: grid;
  z-index: 1; /* keep everything under the header */
  position: relative;
  grid-template-columns: auto;
  /* Adjust for the sidebar's focus ring offset so the page is equally balanced */
  margin-inline-end: calc(var(--quiet-focus-width) + var(--quiet-focus-offset));
  padding-inline: 2rem;
  padding-block-start: var(--docs-header-height);
  padding-block-end: 0;
  gap: var(--docs-content-spacing);
}

#body.has-sidebar {
  grid-template-columns: var(--docs-sidebar-width) auto;
  max-width: var(--docs-max-width);
}

#body.has-sidebar #page {
  padding-inline-start: var(--docs-content-spacing);

  @media screen and (max-width: 959px) {
    padding-inline-start: 1.5rem;
  }
}

/*
  Hide the sidebar on desktop when the page doesn't have it. This allows us to show the toggle button consistently on
  mobile devices.
*/
@media screen and (min-width: 959px) {
  #body:not(.has-sidebar) #sidebar {
    display: none;
  }
}

#page.has-outline {
  grid-template-columns: auto var(--docs-outline-width);
}

.layout-splash #page {
  max-width: 58rem;
  margin-inline: auto;
  padding-inline: 0;
}

.layout-page #body {
  max-width: 70ch;
}

.layout-wide #body {
  max-width: 90ch;
}

/* Mesh gradient container */
.mesh-container {
  --brightness: 50;
  padding: 2rem;
  border-radius: 1rem;

  .features-grid li {
    border-color: color-mix(in oklab, var(--quiet-paper-color), transparent 30%);
    background-color: color-mix(in oklab, var(--quiet-paper-color), transparent 30%);
  }
}

.quiet-dark .mesh-container {
  --brightness: -50;

  .features-grid li {
    border-color: color-mix(in oklab, var(--quiet-paper-color), transparent 15%);
    background-color: color-mix(in oklab, var(--quiet-paper-color), transparent 15%);
  }
}

/* Page-specific settings */
body.browse-components {
  #body {
    max-width: 1500px;
  }

  #page {
    grid-template-columns: unset;
  }
}

#content {
  order: 1;
  min-width: 0; /* prevent overflowing content from stretching the column */
  padding-block-end: 2rem;

  .title {
    margin-block-start: 3rem;
    margin-block-end: 2rem;
  }

  .component-info {
    display: flex;
    flex-wrap: wrap;
    margin-block-start: -1rem;
    margin-block-end: 1rem;
    gap: 0.25rem;
  }

  .component-tag {
    margin-inline-end: 0.25rem;
    padding: 0;
    background: transparent;
    color: var(--quiet-text-muted);
    font-size: 1.2rem;
  }

  @media screen and (max-width: 959px) {
    .component-tag {
      display: block;
      width: 100%;
    }
  }
}

#content pre:has(code) {
  padding: 0;
  clear: both;
  background-color: var(--quiet-neutral-900);

  > code {
    display: block;
    padding: 1rem;
    overflow-x: auto;
    border-radius: inherit;
    background-color: transparent;
    color: white;
    hyphens: none;
    white-space: pre;
    tab-size: 2;
  }
}

#content details pre:has(code) {
  background-color: color-mix(in oklab, var(--quiet-neutral-900), white 5%);
}

#content {
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    quiet-badge {
      font-size: 0.875rem;
      vertical-align: middle;
    }
  }

  quiet-tab-list {
    margin-block-end: 2rem;
  }
}

p code {
  white-space: nowrap;
}

/* Experimental badges */
quiet-badge.experimental {
  background-color: #fbbf24;
  color: black;
}

/* Anchor headings */
.anchor-heading {
  max-width: fit-content;
}

@media (hover: hover) {
  .anchor-heading a {
    visibility: hidden;
    text-decoration: none;
  }

  .anchor-heading:hover a {
    visibility: visible;
    padding: 0 0.125em;
  }
}

@media not (hover: hover) {
  .anchor-heading a {
    color: color-mix(in oklab, var(--quiet-text-muted), transparent 50%);
    text-decoration: none;
  }
}

#content aside {
  max-width: 340px;
  margin-inline-start: 1.5rem;
  margin-block: 1.5rem;
  padding: 1.5rem;
  float: inline-end;
  border-radius: var(--quiet-border-radius-sm);
  background-color: var(--quiet-background-color-lowered);

  :first-child {
    margin-block-start: 0;
  }

  :last-child {
    margin-block-end: 0;
  }

  quiet-tab-list {
    margin-block-end: var(--quiet-content-spacing);
  }

  .code-example quiet-tab-list {
    margin-block-end: revert;
  }
}

@media screen and (max-width: 959px) {
  #content aside {
    max-width: none;
    margin-inline: 0;
    margin-block: 2rem;
    float: none;
  }
}

/* Outline */
#outline {
  position: sticky;
  top: var(--docs-header-height);
  order: 2;
  height: calc(100dvh - var(--docs-header-height));
  padding-block: 3rem 2rem;
  overflow: auto;
  scrollbar-color: var(--quiet-neutral-fill-mid) transparent;
  scrollbar-width: thin;
}

#outline h2 > a {
  color: inherit;
  font-weight: inherit;
}

#outline-expandable {
  display: none;
}

#outline-expandable ul {
  column-gap: 2rem;
  padding-inline: 1rem;
  columns: 2;
}

#outline [data-level='3'] {
  margin-inline-start: 1rem;
}

@media screen and (max-width: 1419px) {
  :root {
    --docs-content-spacing: 4rem;
  }

  #body,
  #navbar {
    padding-inline: 2rem;
  }
}

@media screen and (max-width: 1279px) {
  #page {
    display: block;
    min-width: 0; /* prevent overflowing content from stretching the column */
    padding-inline-end: 2rem;
  }

  #outline {
    position: static;
    height: auto;
    margin-block: 1.5rem -1rem;
    padding-block: 0;
  }

  #outline-standard {
    display: none;
  }

  #outline-expandable {
    display: block;
  }
}

@media screen and (max-width: 959px) {
  .header-group:not(:first-of-type) + .header-group {
    padding-inline-start: 0.5rem;
  }

  #body {
    display: block;
    padding-inline: 0;
  }

  #navbar {
    padding-inline: 0.5rem;
  }

  #open-sidebar,
  #close-sidebar {
    display: flex;
  }

  #close-sidebar {
    position: sticky;
    top: 0.5rem;
    left: calc(100% - 0.5rem);
  }

  #sidebar {
    z-index: var(--docs-sidebar-z-index);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 1rem;
    width: 100%;
    max-width: calc(100% - 2rem);
    height: calc(100% - 2rem);
    margin-block-start: 1rem;
    padding-inline: 1.5rem;
    padding-block: 1rem 2rem;
    translate: 0 100vh;
    border-right: none;
    border-radius: var(--quiet-border-radius-xl);
    background: var(--quiet-background-color);
    font-size: 1rem;
    transition:
      var(--docs-sidebar-speed) translate cubic-bezier(0.33, 1, 0.68, 1),
      var(--docs-sidebar-speed) box-shadow cubic-bezier(0.33, 1, 0.68, 1);

    nav {
      margin-block-start: -1.5rem;
    }
  }

  .docs-sidebar-open #sidebar {
    translate: 0;
    box-shadow: 0 1px 1rem rgb(0 0 0 / 0.33);
  }

  #backdrop {
    z-index: calc(var(--docs-sidebar-z-index) - 1);
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    backdrop-filter: var(--quiet-backdrop-filter);
    -webkit-backdrop-filter: var(--quiet-backdrop-filter);
    background-color: var(--quiet-backdrop-color);
  }

  #page {
    max-width: 70ch;
    margin: 0 auto;
    padding-inline: 1rem;
  }

  #outline-expandable ul {
    columns: 1;
  }
}

.docs-is-resizing #sidebar,
.docs-is-resizing #backdrop {
  transition: none;
}

/* Icon buttons */
.docs-icon-button {
  all: unset;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.33rem;
  cursor: pointer;
}

.docs-icon-button:focus-visible {
  outline: var(--quiet-focus-ring);
  outline-offset: 2px;
}

.docs-icon-button > svg {
  align-self: center;
  justify-self: center;
  width: 1.5rem;
  height: 1.5rem;
}

.docs-icon-button > quiet-icon {
  font-size: 1.5rem;
}

/* Aside content */
.docs-aside {
  font-size: 0.875rem;
  line-height: calc(var(--quiet-line-height) * 0.875);
}

.docs-aside h2 {
  margin-block: 0.5rem;
  font-size: inherit;

  a {
    text-decoration: none;
  }

  quiet-icon {
    font-size: 1.25rem;
    vertical-align: -0.25em;
    opacity: 0.5;
  }
}

.docs-aside ul {
  margin-inline: 0;

  &:last-child {
    margin-block-end: 0;
  }
}

.docs-aside ul ul {
  margin-inline-start: 0.25rem;
  margin-block: 0.5rem;
  padding-inline-start: 0.75rem;
  border-inline-start: var(--quiet-border-style) var(--quiet-border-width) var(--quiet-neutral-stroke-soft);
}

.docs-aside li {
  color: var(--quiet-text-muted);
  font-weight: var(--quiet-font-weight-normal);
  list-style: none;
}

.docs-aside li:not(:last-of-type) {
  margin-block-end: 0.6rem;
}

.docs-aside li a {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
  transition: 150ms color ease;

  @media (hover: hover) {
    &:not(.current):hover {
      position: relative;
      border-radius: var(--quiet-border-radius-md);
      color: var(--quiet-primary-text-colorful);
      text-decoration: underline;
    }
  }

  .external-link-icon {
    opacity: 0.5;
  }
}

.docs-aside li quiet-icon {
  vertical-align: -2px;
}

.docs-aside ul {
  .current {
    color: var(--quiet-primary-text-colorful);
    font-weight: var(--quiet-font-weight-semibold);
  }

  li:has(.current) quiet-icon {
    stroke-width: 2px;
  }
}

/* Callouts */
quiet-callout {
  margin-block-end: 2rem;

  > :last-child {
    margin-block-end: 0;
  }

  code {
    white-space: nowrap;
  }

  a {
    color: inherit;
  }

  &[variant='neutral'] {
    code {
      background-color: color-mix(in oklab, var(--quiet-neutral-fill-soft), transparent 50%);
    }

    kbd,
    quiet-hotkey {
      border-color: var(--quiet-neutral-fill-soft);
      box-shadow: 0 max(1px, 0.0715em) 0 0 var(--quiet-neutral-fill-soft);
    }
  }

  &[variant='primary'] {
    code {
      background-color: color-mix(in oklab, var(--quiet-primary-fill-soft), transparent 50%);
    }

    kbd,
    quiet-hotkey {
      border-color: var(--quiet-primary-fill-soft);
      box-shadow: 0 max(1px, 0.0715em) 0 0 var(--quiet-primary-fill-soft);
    }
  }

  &[variant='constructive'] {
    code {
      background-color: color-mix(in oklab, var(--quiet-constructive-fill-soft), transparent 50%);
    }

    kbd,
    quiet-hotkey {
      border-color: var(--quiet-constructive-fill-soft);
      box-shadow: 0 max(1px, 0.0715em) 0 0 var(--quiet-constructive-fill-soft);
    }
  }

  &[variant='destructive'] {
    code {
      background-color: color-mix(in oklab, var(--quiet-destructive-fill-soft), transparent 50%);
    }

    kbd,
    quiet-hotkey {
      border-color: var(--quiet-destructive-fill-soft);
      box-shadow: 0 max(1px, 0.0715em) 0 0 var(--quiet-destructive-fill-soft);
    }
  }
}

/* Grid background */
.with-grid {
  position: relative;
  background-image:
    /* Gradient bottom fade to primary */
    linear-gradient(
      to bottom,
      transparent 66%,
      color-mix(in oklab, var(--quiet-primary-fill-mid), transparent 85%) 100%
    ),
    /* Dots */
      radial-gradient(color-mix(in oklab, var(--quiet-primary-fill-mid), transparent 85%) 1px, transparent 1.5px);
  background-position:
    100%,
    0 0;
  background-size:
    100%,
    1.125em 1.125em;
  background-repeat: no-repeat, space;
  background-attachment: fixed;
  text-wrap: balance;
}

/* Splash layout */
.layout-splash:not(.scrolled-down) #header {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background-color: transparent;
}

.layout-splash:not(.scrolled-down) #header::after {
  border-color: transparent;
}

.layout-splash #page {
  /* Don't overflow in landscape + mobile */
  @media screen and (max-height: 600px) {
    height: auto;
  }
}

.splash {
  display: flex;
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: calc(100svh - var(--docs-header-height));
  margin-inline: auto;
  padding-inline: 2rem;
  font-weight: var(--quiet-font-weight-bold);
  font-size: 1.375rem;
  line-height: 1.4;
  text-align: center;

  p {
    text-wrap: balance;
  }

  @media screen and (max-height: 700px) {
    height: auto;
    margin-block-end: 2rem;
    padding-block-end: 4rem;
  }
}

.splash-image {
  width: 100%;

  img,
  svg {
    display: block;
    width: 100%;
    max-width: 700px;
    max-height: 300px;
    margin-inline: auto;
    margin-block-end: 2rem;

    /* Smaller image on mobile */
    @media screen and (max-width: 959px) {
      max-width: 50vw;
      margin-block-end: 1rem;
    }
  }
}

.splash .subtitle {
  margin-block: 1rem;
  font-size: 4.25rem;
  line-height: 1.2;
}

.splash-actions {
  display: flex;
  justify-content: center;
  margin-block-start: 2rem;
  gap: 1rem;

  @media screen and (max-height: 550px) {
    margin-block-start: 1rem;
  }
}

.quick-start {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-block: 2rem 4rem;
  gap: 1rem;

  quiet-button::part(button) {
    border-color: var(--quiet-strident);
    color: var(--quiet-strident);
  }
}

@media screen and (max-width: 600px) {
  .splash-actions {
    flex-direction: column;
    align-items: center;
    margin-block-end: 0;

    quiet-button {
      width: 100%;
    }
  }
}

@media screen and (max-width: 959px) {
  .splash {
    margin-block: 0;
  }

  .splash .subtitle {
    font-size: 2.5rem;
  }

  .splash .focusing-on {
    font-size: 1rem;
  }

  #body.has-sidebar #page {
    padding-inline: 1rem;
  }
}

#content .below-splash {
  max-width: calc(70ch + 4rem);
  margin-inline: auto;
  padding-inline: 2rem;

  h2,
  h3,
  h4,
  p,
  div {
    text-align: center;
    text-wrap: balance;
  }

  h2 {
    margin-block-start: 1.5rem;
  }

  pre:has(code) {
    box-shadow: var(--quiet-shadow-soft);
  }

  .features-grid {
    margin-block-start: 1rem;
    margin-block-end: 6rem;
  }

  .whiskers-center {
    margin-block-start: 4rem;
  }
}

/* Dark mode */
.quiet-dark #content .below-splash {
  pre:has(code) {
    backdrop-filter: blur(6px);
    background-color: color-mix(in oklab, var(--quiet-silent), transparent 50%);

    code {
      background: transparent;
    }
  }
}

#more-hint {
  display: flex;
  position: absolute;
  bottom: 1rem;
  left: calc(50% - 1.5rem);
  color: var(--quiet-strident);
  font-size: 3rem;
  animation: hint-bounce 2s infinite;
  transition:
    0.5s ease scale,
    0.5s ease opacity;

  @media screen and (max-width: 767px) {
    bottom: 1rem;
  }

  @media screen and (max-height: 800px) {
    opacity: 0;
  }
}

body.scrolled-down #more-hint {
  scale: 0.75;
  animation: none;
  opacity: 0;
  pointer-events: none;
}

@keyframes hint-bounce {
  0%,
  20%,
  50%,
  80%,
  70%,
  100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-6px);
  }
  60% {
    transform: translateY(-3px);
  }
}

/* Testimonials */
.testimonials-cover {
  --brightness: 50;
  width: 100vw;
  margin-inline-start: calc(-50vw + 50%);
  margin-block-end: 2rem;
  padding: 4rem 0;
  border-radius: 0;
  background-color: var(--quiet-neutral-fill-softer);
  color: var(--quiet-neutral-text-on-soft);

  @media (max-width: 599px) {
    padding-block: 1rem;
  }
}

.quiet-dark .testimonials-cover {
  --brightness: -50;
}

.testimonials {
  display: grid;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 4rem;
  overflow: hidden;
  gap: 1rem;

  @media (min-width: 900px) {
    grid-template-columns: repeat(3, 1fr);
  }

  @media (min-width: 600px) and (max-width: 899px) {
    grid-template-columns: repeat(2, 1fr);
  }

  @media (max-width: 599px) {
    grid-template-columns: 1fr;
    padding: 0 1rem;
  }
}

.testimonial {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2rem;
  border-right: 1px solid var(--quiet-neutral-border);
  border-bottom: 1px solid var(--quiet-neutral-border);
  border: var(--quiet-border-style) var(--quiet-border-width)
    color-mix(in oklab, var(--quiet-paper-color), transparent 15%);
  border-radius: var(--quiet-border-radius-lg);
  background-color: color-mix(in oklab, var(--quiet-paper-color), transparent 15%);
  color: var(--quiet-neutral-text-on-soft);
  text-wrap: balance;

  q {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;

    &::before,
    &::after {
      opacity: 0.33;
    }

    &::before {
      margin-inline-end: 0.125em;
    }

    &::after {
      margin-inline-start: 0.125em;
    }
  }

  @media (min-width: 900px) {
    &:nth-child(1),
    &:nth-child(7),
    &:nth-child(8),
    &:nth-child(14),
    &:nth-child(15) {
      grid-column: span 2;
    }

    &:nth-child(3n) {
      border-right: none;
    }

    &:nth-child(1),
    &:nth-child(2) {
      border-right: none;
    }

    &:nth-last-child(-n + 3) {
      border-bottom: none;
    }
  }

  @media (min-width: 600px) and (max-width: 899px) {
    &:nth-child(2n) {
      border-right: none;
    }

    &:nth-last-child(-n + 2) {
      border-bottom: none;
    }
  }

  @media (max-width: 599px) {
    padding: 1.25rem;
    border-right: none;

    &:last-child {
      border-bottom: none;
    }
  }

  cite {
    font-style: normal;
    font-size: 0.875rem;
    opacity: 0.66;

    a {
      color: inherit;
      font-weight: inherit;

      .external-link-icon {
        display: none;
      }
    }
  }
}

/* Tables */
th.table-reflects {
  text-align: center;
}

td.table-reflects {
  font-size: 1.25em;
  text-align: center;

  [name='check'] {
    color: var(--quiet-constructive-text-colorful);
  }

  [name='x'] {
    color: var(--quiet-destructive-text-colorful);
  }
}

/* Component pages */
.component-summary {
  font-size: 1.25rem;
}

#content table code {
  background: none;
  color: inherit;
}

html:not(.quiet-dark) quiet-scroller:has(.component-table),
#content quiet-scroller:has(table) {
  --shadow-color: #0001;
  --shadow-size: 0.75rem;

  /* Add a border to each shadow */
  &::part(start-shadow) {
    border-left: solid 1px #0002;
  }

  &::part(end-shadow) {
    border-right: solid 1px #0002;
  }

  /* Taper the shadows at the top and bottom for a realistic effect */
  &::part(start-shadow),
  &::part(end-shadow) {
    mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
  }
}

/* Copy buttons in tables */
.component-table quiet-copy quiet-button {
  &::part(button) {
    padding: 0;
    gap: 0.1rem;
    background: transparent;
    font-size: inherit;
  }

  &::part(button):active {
    translate: 0;
  }

  quiet-icon {
    font-size: 1rem;
  }
}

.table-description,
.table-arguments {
  min-width: 35ch;
}

.table-name code,
.table-description code,
.table-attribute code,
.table-type code,
.table-selector code,
.table-default code {
  display: inline-block;
  white-space: nowrap;
}

/* Mascot images */
.whiskers-center {
  display: block;
  width: auto;
  max-height: 12rem;
  margin-inline: auto;
  margin-block-end: 1.5rem;

  @media screen and (max-width: 959px) {
    max-height: 7.5rem;
  }
}

.whiskers-end {
  display: inline;
  width: auto;
  max-height: 12rem;
  margin-inline-start: 1.5rem;
  margin-block-end: 1.5rem;
  float: right;

  @media screen and (max-width: 959px) {
    max-height: 7.5rem;
  }
}

.whiskers-center-large {
  display: block;
  width: auto;
  max-height: 20rem;
  margin-inline: auto;
  margin-block-end: 1.5rem;

  @media screen and (max-width: 959px) {
    max-height: 16rem;
  }
}

.whiskers-email {
  position: relative;
  width: 300px;
  margin-inline: auto;
  margin-block: 3rem;
  text-align: center;

  img,
  svg {
    display: block;
    width: 100%;
    width: 230px;
    height: auto;
    margin-inline: auto;
  }

  .whiskers-email-controls {
    display: flex;
    position: absolute;
    top: 120px;
    left: 16%;
    align-items: center;
    width: 67%;
    gap: 8px;
  }

  small {
    display: block;
    margin-block-start: 1rem;
  }

  quiet-text-field {
    flex: 1 1 auto;

    &::part(label) {
      position: absolute;
      width: 1px;
      height: 1px;
      overflow: hidden;
      white-space: nowrap;
      clip-path: inset(50%);
    }

    &::part(description) {
      display: none;
    }
  }

  quiet-button {
    flex: 0 0 auto;
  }
}

/* Avatars */
.avatar {
  max-width: 10rem;
  height: auto;
  margin-inline-start: 2rem;
  margin-block-end: 1rem;
  float: right;
  border-radius: var(--quiet-border-radius-circle);

  @media screen and (max-width: 959px) {
    max-width: 7.5rem;
  }
}

/* Features grid */
.features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
  margin-block-end: 2rem;
  padding: 0;
  gap: 2rem;

  li {
    /* Padding is calculated for stretch links */
    --grid-padding-block: 2.5rem;
    --grid-padding-inline: 1.5rem;

    display: block;
    position: relative;
    margin: 0;
    padding: 1rem;
    border: var(--quiet-border-style) var(--quiet-border-width) var(--quiet-neutral-stroke-softer);
    border-radius: 1rem;
    background-color: var(--quiet-paper-color);
    box-shadow: var(--quiet-shadow-softer);
    color: color-mix(in oklab, var(--quiet-neutral-text-on-soft), transparent 25%);
    font-weight: var(--quiet-font-weight-semibold);
    line-height: 1.6;
    list-style: none;
    text-align: center;

    small {
      font-weight: var(--quiet-font-weight-normal);
    }

    &:has(a) {
      transition: all 150ms ease-out;

      @media (hover: hover) {
        &:hover {
          transform: translateY(-3px) scale(1.02);
          box-shadow: var(--quiet-shadow-soft);
        }
      }
    }

    /* Stretchy links */
    &:has(a.stretch) {
      padding: var(--grid-padding-block) var(--grid-padding-inline);
    }

    a.stretch {
      display: block;
      position: relative;
      top: 0;
      left: 0;
      width: calc(100% + calc(var(--grid-padding-inline) * 2));
      height: calc(100% + calc(var(--grid-padding-block) * 2));
      margin: calc(-1 * var(--grid-padding-block)) calc(-1 * var(--grid-padding-inline));
      padding: 1rem;
      border-radius: inherit;
      color: inherit;
      font-weight: var(--quiet-font-weight-normal);
      text-decoration: none;
    }

    quiet-icon {
      font-size: 4rem;
      stroke-width: 1px;
    }

    img,
    svg {
      display: inline-block;
      width: auto;
      max-width: 4rem;
      height: 4rem;
      max-height: 4rem;
    }
  }
}

@media screen and (max-width: 650px) {
  .features-grid {
    grid-template-columns: 1fr;
    max-width: 22rem;
    margin-inline: auto;
    gap: 1rem;

    li {
      font-size: 1rem;
    }

    &::first-letter {
      font-size: 1rem;
    }
  }
}

/* Pricing table - Base styles shared by both variations */
.pricing-tiers-double,
.pricing-tiers-triple {
  display: grid;
  gap: 0.5rem;
  text-align: center;

  h3 {
    font-size: 1.5rem;
  }

  h3:first-of-type {
    margin-block: 0;
    text-align: center;
  }

  @media screen and (min-width: 768px) and (max-width: 959px) {
    h3 {
      font-size: 1.33rem;
    }
  }
}

/* 2-column variation with equal sizes */
.pricing-tiers-double {
  grid-template-columns: 1fr 1fr;
  max-width: calc(620px + 3rem);
  margin-inline: auto;
  gap: 1rem;

  @media screen and (min-width: 768px) {
    margin-block: 3rem;
  }

  @media screen and (max-width: 767px) {
    grid-template-columns: 1fr;
    max-width: 320px;
    margin-inline: auto;
    margin-block: 2rem;
    gap: 0.5rem;
  }
}

/* 3-column variation with scaled center */
.pricing-tiers-triple {
  grid-template-columns: 1fr 1fr 1fr;

  @media screen and (min-width: 768px) {
    margin-block: 3rem;

    .pricing-tier:nth-child(1) {
      border-top-right-radius: 0;
      border-bottom-right-radius: 0;
    }

    .pricing-tier:nth-child(2) {
      scale: 1.09;
    }

    .pricing-tier:nth-child(3) {
      border-top-left-radius: 0;
      border-bottom-left-radius: 0;
    }
  }

  @media screen and (max-width: 767px) {
    grid-template-columns: 1fr;
    max-width: 320px;
    margin-inline: auto;
    margin-block: 2rem;
    gap: 0.5rem;

    .pricing-tier:nth-child(2) {
      scale: 1.1;
    }
  }
}

.pricing-tier {
  padding: 1.5rem 1rem 2rem 1rem;
  border: var(--quiet-border-style) var(--quiet-border-width) var(--quiet-neutral-stroke-softer);
  border-radius: 1rem;
  background-color: var(--quiet-paper-color);
  box-shadow: var(--quiet-shadow-softer);

  quiet-icon.pricing-tier-icon {
    font-size: 4rem;
    stroke-width: 1px;
  }

  img.pricing-tier-icon,
  svg.pricing-tier-icon {
    max-width: 4rem;
    height: 4rem;
    margin-inline: auto;
  }

  ul {
    width: fit-content;
    margin: 0 0 2rem 0;
    margin-inline: auto;
    padding: 0;
    color: var(--quiet-text-muted);
    font-size: 0.9375rem;
    text-align: start;

    mark {
      color: var(--quiet-text-body);
    }

    @media screen and (min-width: 768px) and (max-width: 959px) {
      font-size: 0.875rem;
    }
  }

  li {
    margin: 0;
    padding: 0;
    list-style: none;

    quiet-icon {
      vertical-align: -2px;
    }
  }

  quiet-button {
    min-width: 85%;
  }
}

/* Special styling for middle tier in 3-column layout */
.pricing-tiers-triple .pricing-tier:nth-child(2) ul {
  color: var(--quiet-text-body);
}

/* Unlimited buttons */
.button-unlimited {
  &::part(button) {
    background-color: var(--quiet-neutral-fill-loud);
    color: var(--quiet-neutral-text-on-loud);
  }

  &:hover::part(button) {
    background-color: color-mix(in oklab, var(--quiet-neutral-fill-loud), black 5%);
  }
}

/* FAQ */
h2 + details {
  margin-block-start: 2rem;
}

/* Copyrights */
.copyright {
  display: block;
  color: revert;
  text-align: center;
}

.link-disguised {
  color: inherit;
  font-weight: inherit;
}

/* Print styles */
@media print {
  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  .features-grid {
    break-after: avoid;
  }

  #header,
  #sidebar,
  #outline {
    display: none !important;
  }

  #page {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #body {
    display: block !important;
    width: auto !important;
    max-width: none !important;
  }

  .code-example,
  .code-example-source {
    border: none !important;
  }

  .code-example-preview,
  .code-example-buttons {
    display: none !important;
  }

  .code-example-source {
    display: block !important;
  }

  quiet-scroller {
    &::part(content) {
      max-width: 100% !important;
      overflow: visible !important;
    }
  }

  .component-table {
    td {
      width: auto !important;
      min-width: 0 !important;
    }

    quiet-copy quiet-icon {
      display: none !important;
    }
  }
}

h1.title + p:has(quiet-badge:first-child):has(quiet-badge:last-child) {
  display: flex;
  align-items: center;
  margin-block-start: -0.75rem;
  gap: 0.25rem;
}

/* Ribbons  */
.with-ribbon {
  position: relative;

  .ribbon {
    display: flex;
    position: absolute;
    top: -2px;
    right: 1rem;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 5rem;
    padding-inline: 0.5rem;
    padding-block-end: 0.5rem;
    background: linear-gradient(135deg, deeppink 0%, color-mix(in oklab, deeppink, #705ec2 50%) 100%);
    color: white;
    font-weight: bold;
    font-size: 0.875rem;
    line-height: 1.2;
    text-shadow: 0 -1px color-mix(in oklab, black, transparent 95%);
    clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
  }
}
