:root {
  --docs-text: #434e4e;
  --docs-text-strong: #1c1e1e;
  --docs-text-subdued: #767676;
  --docs-surface: #fff;
  --docs-surface-subdued: #f9f9f9;
  --docs-surface-code-inline: #f1f1f1;
  --docs-primary: #008060;
  --docs-border-color: #e9e9e9;
  --docs-color-neutral-0: hsl(0 0% 100%);
  --docs-color-neutral-50: hsl(0 0% 97.5%);
  --docs-color-neutral-100: hsl(240 4.8% 95.9%);
  --docs-color-neutral-200: hsl(240 5.9% 90%);
  --docs-color-neutral-300: hsl(240 4.9% 83.9%);
  --docs-color-neutral-400: hsl(240 5% 64.9%);
  --docs-color-neutral-600: hsl(240 5.2% 33.9%);
  --docs-color-neutral-800: hsl(240 3.7% 15.9%);
  --docs-color-neutral-900: hsl(240 5.9% 10%);
  --docs-border-width: 1px;
  --docs-border-radius: var(--ahi-border-radius-medium);
  --docs-header-height: 56px;
  --docs-content-max-width: 860px;
  --docs-content-toc-max-width: 260px;
  --docs-content-vertical-spacing: 1rem;
  --docs-code-blue: var(--ahi-color-blue-600);
  --docs-code-red: var(--ahi-color-red-600);
  --docs-code-green: var(--ahi-color-green-600);
  --docs-code-purple: var(--ahi-color-purple-600);
  --docs-code-orange: var(--ahi-color-orange-600);
  --ahi-color-accent: #0077c0;
  --ahi-color-accent-secondary: #133449;
  --ahi-color-text-on-accent: #fff;
  --ahi-layout-background-color: var(--docs-surface);
}

/* Light theme */
:root {
  color-scheme: normal;
}

/* Dark theme */
.ahi-theme-dark {
  color-scheme: dark;

  --docs-text: #b0b0bc;
  --docs-text-strong: #e7e7f1;
  --docs-text-subdued: #85858e;
  --docs-surface: #161619;
  --docs-surface-subdued: #1e1e23;
  --docs-surface-code-inline: #3b3b3c;
  --docs-primary: #1aab87;
  --docs-border-color: #373737;
  --docs-color-neutral-0: hsl(240, 5.9%, 11%);
  --docs-color-neutral-50: hsl(240 5.1% 15%);
  --docs-color-neutral-100: hsl(240 5.7% 18.2%);
  --docs-color-neutral-200: hsl(240 4.6% 22%);
  --docs-color-neutral-300: hsl(240 5% 27.6%);
  --docs-color-neutral-400: hsl(240 5% 35.5%);
  --docs-color-neutral-600: hsl(240 5.3% 58%);
  --docs-color-neutral-800: hsl(240 7.3% 84%);
  --docs-color-neutral-900: hsl(240 9.1% 91.8%);
  --docs-code-blue: var(--ahi-color-blue-400);
  --docs-code-red: var(--ahi-color-red-400);
  --docs-code-green: var(--ahi-color-green-400);
  --docs-code-purple: var(--ahi-color-purple-400);
  --docs-code-orange: var(--ahi-color-orange-400);
}

/* Utils */
html.ahi-theme-dark .only-light,
html:not(.ahi-theme-dark) .only-dark {
  display: none !important;
}

.nowrap {
  white-space: nowrap;
}

/* Bare styles */
*,
*:before,
*:after {
  box-sizing: inherit;
}

a:focus,
button:focus {
  outline: none;
}

a:focus-visible,
button:focus-visible {
  outline: var(--ahi-focus-ring);
  outline-offset: var(--ahi-focus-ring-offset);
}

/* Show custom elements only after they're registered */
:not(:defined),
:not(:defined) * {
  opacity: 0;
}

:defined {
  opacity: 1;
  transition: 0.1s opacity;
}

html {
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  border: 0;
  margin: 0;
  padding: 0;
  font-family: var(--ahi-font-family-sans);
  font-weight: var(--ahi-font-weight-regular);
  line-height: var(--ahi-line-height-700);
  color: var(--docs-text);
}

body {
  height: 100%;
  padding: 0;
  margin: 0;
  overflow-x: hidden;
  -moz-osx-font-smoothing: grayscale;
  -webkit-font-smoothing: antialiased;
}

/* Common elements */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--ahi-font-family-sans);
  font-weight: var(--ahi-font-weight-bold);
  color: var(--docs-text-strong);
  margin: 3rem 0 1.5rem 0;
  scroll-margin-top: var(--docs-header-height);
}

h1:first-of-type {
  margin-top: 1rem;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 1.875rem;
}

h3 {
  font-size: 1.625rem;
}

h4 {
  font-size: 1.375rem;
}

h5 {
  font-size: 1.125rem;
}

h6 {
  font-size: 0.875rem;
}

p {
  margin-block-end: 1.5em;
}

img {
  max-width: 100%;
}

a {
  color: var(--ahi-interactive);
  text-decoration: none;
}

a:hover {
  color: var(--ahi-interactive-hovered);
}

a:active {
  color: var(--ahi-interactive-depressed);
}

a:disabled {
  color: var(--ahi-interactive-disabled);
}

em {
  font-style: italic;
}

strong {
  font-weight: var(--ahi-font-weight-bold);
}

code {
  font-family: var(--ahi-font-family-mono);
  font-size: 0.9125em;
  background-color: var(--docs-surface-code-inline);
  border-radius: var(--docs-border-radius);
  padding: 0.125em 0.25em;
}

/* Lists */
ul,
ol {
  padding: 0;
  margin: 0 0 var(--docs-content-vertical-spacing) 2rem;
}

ul {
  list-style: disc;
}

li {
  padding: 0;
  margin: 0 0 0.25rem 0;
}

li ul,
li ol {
  margin-top: 0.25rem;
}

ul ul:last-child,
ul ol:last-child,
ol ul:last-child,
ol ol:last-child {
  margin-bottom: 0;
}

/* Anchor headings */
.anchor-heading {
  position: relative;
  color: var(--docs-text-strong);
  text-decoration: none;
}

.anchor-heading a {
  text-decoration: none;
  color: inherit;
}

.anchor-heading a::after {
  content: '#';
  color: var(--ahi-interactive);
  margin-inline: 0.5rem;
  opacity: 0;
  transition: 100ms opacity;
}

.anchor-heading:hover a::after,
.anchor-heading:focus-within a::after {
  opacity: 1;
}

/* Tables */
table {
  max-width: 100%;
  border: none;
  border-collapse: collapse;
  color: inherit;
  margin-bottom: var(--docs-content-vertical-spacing);
}

table tr {
  border-bottom: solid var(--docs-border-width) var(--docs-border-color);
}

table th {
  font-weight: var(--ahi-font-weight-semibold);
  text-align: left;
}

table td,
table th {
  line-height: var(--ahi-line-height-700);
  padding: 1rem 1rem;
}

table th p:first-child,
table td p:first-child {
  margin-top: 0;
}

table th p:last-child,
table td p:last-child {
  margin-bottom: 0;
}

.table-scroll {
  max-width: 100%;
  overflow-x: auto;
}

.table-scroll code {
  white-space: nowrap;
}

th.table-name,
th.table-event-detail {
  min-width: 15ch;
}

th.table-description {
  min-width: 50ch !important;
  max-width: 70ch;
}

/* Code blocks */
pre {
  position: relative;
  background-color: rgba(0, 0, 0, 0.02);
  font-family: var(--ahi-font-family-mono);
  color: var(--docs-text);
  border-radius: var(--docs-border-radius);
  padding: 1rem;
  white-space: pre;
}

.ahi-theme-dark pre {
  background-color: hsla(0, 0%, 100%, 0.05);
}

pre:not(:last-child) {
  margin-bottom: 1.5rem;
}

pre > code {
  display: block;
  background: none !important;
  border-radius: 0;
  hyphens: none;
  tab-size: 2;
  white-space: pre;
  padding: 1rem;
  margin: -1rem;
  overflow: auto;
}

pre .token.comment {
  color: var(--docs-text-subdued);
}

pre .token.prolog,
pre .token.doctype,
pre .token.cdata,
pre .token.operator,
pre .token.punctuation {
  color: var(--docs-text);
}

.namespace {
  opacity: 0.7;
}

pre .token.property,
pre .token.keyword,
pre .token.tag,
pre .token.url {
  color: var(--docs-code-blue);
}

pre .token.symbol,
pre .token.important,
pre .token.deleted {
  color: var(--docs-code-red);
}

pre .token.boolean,
pre .token.constant,
pre .token.selector,
pre .token.attr-name,
pre .token.string,
pre .token.char,
pre .token.builtin,
pre .token.inserted {
  color: var(--docs-code-green);
}

pre .token.atrule,
pre .token.attr-value,
pre .token.number,
pre .token.variable {
  color: var(--docs-code-purple);
}

pre .token.function,
pre .token.class-name,
pre .token.regex {
  color: var(--docs-code-orange);
}

pre .token.important,
pre .token.bold {
  font-weight: var(--ahi-font-weight-semibold);
}

pre .token.italic {
  font-style: italic;
}

/* Copy code button */
.copy-code-button {
  display: flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: var(--docs-color-neutral-0);
  border-radius: calc(var(--docs-border-radius) * 0.875);
  border: solid 1px var(--docs-color-neutral-200);
  color: var(--docs-color-neutral-800);
  text-transform: uppercase;
  padding: 0.5rem;
  margin: 0;
  cursor: pointer;
  transition:
    100ms opacity,
    100ms scale;
}

.copy-code-button svg {
  width: 1rem;
  height: 1rem;
}

pre .copy-code-button {
  opacity: 0;
  scale: 0.9;
}

pre:hover .copy-code-button,
.copy-code-button:focus-within {
  opacity: 1;
  scale: 1;
}

pre:hover .copy-code-button:hover,
pre:hover .copy-code-button--copied {
  background: var(--docs-color-neutral-200);
  border-color: var(--docs-color-neutral-300);
  color: var(--docs-color-neutral-900);
}

/* Callouts */
ahi-banner p {
  margin: 0;
}

/* Tabs */
ahi-tab-group::part(nav) {
  background-color: transparent;
}

ahi-button.logo-button::part(base) {
  justify-content: start;
}

ahi-button.logo-button img {
  width: 100%;
  max-height: calc(var(--navigation-header-block-size) - var(--ahi-space-4));
}

/* Component layouts */
.content {
  display: grid;
  grid-template-columns: 100%;
  gap: 2rem;
  position: relative;
  max-width: var(--docs-content-max-width);
  margin: 0 auto;
}

.content--with-toc {
  /* There's a 2rem gap, so we need to remove it from the column */
  grid-template-columns: calc(75% - 2rem) min(25%, var(--docs-content-toc-max-width));
  max-width: calc(var(--docs-content-max-width) + var(--docs-content-toc-max-width));
}

.content__body {
  order: 1;
  width: 100%;
}

.content:not(.content--with-toc) .content__toc {
  display: none;
}

.content__toc {
  order: 2;
  display: flex;
  flex-direction: column;
  margin-top: 0;
}

.content__toc ul {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 6rem);
  font-size: var(--ahi-font-size-350);
  line-height: 1.33;
  border-left: solid 1px var(--docs-border-color);
  list-style: none;
  padding: 1rem 0;
  margin: 0;
  padding-left: 1rem;
  overflow-y: auto;
}

.content__toc li {
  padding: 0 0 0 0.5rem;
  margin: 0;
}

.content__toc li[data-level='3'] {
  margin-left: 1rem;
}

/* We don't use them, but just in case */
.content__toc li[data-level='4'],
.content__toc li[data-level='5'],
.content__toc li[data-level='6'] {
  margin-left: 2rem;
}

.content__toc li:not(:last-of-type) {
  margin-bottom: 0.6rem;
}

.content__toc a {
  color: var(--docs-text);
  text-decoration: none;
}

.content__toc a:hover {
  color: var(--docs-text-strong);
}

.content__toc a.active {
  font-weight: var(--ahi-font-weight-medium);
  color: var(--docs-text-strong);
}

.content__toc .top a {
  font-weight: var(--ahi-font-weight-medium);
  color: var(--docs-text);
}

@media screen and (max-width: 1024px) {
  .content {
    grid-template-columns: 100%;
    gap: 0;
  }

  .content__toc {
    position: relative;
    order: 1;
  }

  .content__toc ul {
    display: flex;
    justify-content: start;
    gap: 1rem 1.5rem;
    position: static;
    border: none;
    border-bottom: solid 1px var(--docs-border-color);
    border-radius: 0;
    padding: 1rem 1.5rem 1rem 0.5rem; /* extra right padding to hide the fade effect */
    margin-top: 1rem;
    overflow-x: auto;
  }

  .content__toc ul::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 1rem; /* don't cover the scrollbar */
    right: 0;
    width: 2rem;
    background: linear-gradient(90deg, rgba(0 0 0 / 0) 0%, var(--docs-color-neutral-0) 100%);
  }

  .content__toc li {
    white-space: nowrap;
  }

  .content__toc li:not(:last-of-type) {
    margin-bottom: 0;
  }

  .content__toc [data-level]:not([data-level='2']) {
    display: none;
  }

  .content__body {
    order: 2;
  }
}

/* Theme selector */
#theme-selector:not(:defined) {
  /* Hide when not defined to prevent extra wide icon toolbar while loading */
  display: none;
}

#theme-selector {
  margin-right: 1rem;
}

#theme-selector ahi-menu {
  /* Set an initial size to prevent width being initially too small when first opening on small screen width */
  width: 140px;
}

#theme-selector ahi-button::part(label) {
  display: flex;
  padding: 0.5rem;
}

/* Component headers */
.component-header h1 {
  margin-bottom: 0;
}

.component-header__tag {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.component-header__tag code {
  background: none;
  color: var(--ahi-color-gray-600);
  font-size: var(--ahi-font-size-500);
  padding: 0;
  margin: 0;
}

.component-header__info {
  margin-bottom: var(--ahi-space-6);
}

.component-summary {
  font-size: 1.125rem;
  font-weight: 500;
  letter-spacing: var(--ahi-letter-spacing-dense);
  margin: 2rem 0;
}
/* Border demo */
.border-demo {
  width: 3rem;
  height: 3rem;
  background: var(--ahi-text);
}

/* Color demo */
.color-demo {
  border-radius: var(--docs-border-radius);
  color: var(--ahi-text);
  position: relative;
  height: 4rem;
  width: 4rem;
}

.color-demo-dark,
.ahi-theme-dark .color-demo-light {
  display: none;
}

.ahi-theme-dark .color-demo-dark {
  display: inline;
}

/* Transition demo */
.transition-demo {
  position: relative;
  background: var(--docs-color-neutral-200);
  width: 8rem;
  height: 2rem;
}

.transition-demo:after {
  content: '';
  position: absolute;
  background-color: var(--ahi-interactive);
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  transition-duration: inherit;
  transition-property: width;
}

.transition-demo:hover:after {
  width: 100%;
}

/* Spacing demo */
.spacing-demo {
  width: 100px;
  background: var(--ahi-interactive);
}

/* Shadow demo */
.shadow-demo {
  background: white;
  border-radius: 3px;
  width: 4rem;
  height: 4rem;
  margin: 1rem;
}
