.docs-cta {
  margin: 1rem;
  margin-left: 0px;
  display: inline-block;
  width: -moz-max-content;
  width: max-content;
  text-wrap: balance;
  border-radius: 9999px;
  border-width: 1px;
  padding-top: 0.875rem;
  padding-bottom: 0.875rem;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  font-weight: 700;
  --tw-text-opacity: 1;
  color: rgb(0 0 0 / var(--tw-text-opacity, 1));
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

.docs-cta:hover {
  text-decoration-line: none;
}

.runtime-cta,
.deploy-cta {
  border-color: hsl(var(--gray-900-hsl));
  color: hsl(var(--gray-900-hsl)) !important;
}

.runtime-cta:hover,
.deploy-cta:hover {
  text-decoration-line: none !important;
}

.runtime-cta {
  border-width: 0px;
  --tw-bg-opacity: 1;
  background-color: rgb(50 245 154 / var(--tw-bg-opacity, 1));
}

.runtime-cta:hover {
  --tw-bg-opacity: 1;
  background-color: rgb(112 255 174 / var(--tw-bg-opacity, 1));
}

.deploy-cta {
  border-radius: 9999px;
  border-width: 0px;
  background-color: hsl(var(--deploy-300-hsl));
}

.deploy-cta:hover {
  background-color: hsl(var(--deploy-400-hsl));
}

.jsr-cta {
  border-width: 2px;
  --tw-border-opacity: 1;
  border-color: rgb(8 51 68 / var(--tw-border-opacity, 1));
  --tw-bg-opacity: 1;
  background-color: rgb(247 223 30 / var(--tw-bg-opacity, 1));
  --tw-text-opacity: 1 !important;
  color: rgb(8 51 68 / var(--tw-text-opacity, 1)) !important;
}

.jsr-cta:hover {
  --tw-bg-opacity: 1;
  background-color: rgb(250 238 74 / var(--tw-bg-opacity, 1));
  text-decoration-line: none !important;
}

.deploy-button {
  padding-left: 3rem;
  background-image: url("../deno-deploy.svg");
  background-repeat: no-repeat;
  background-position: 1.25rem center;
  background-size: 1.25rem;
}

.columns {
  margin: 2rem 0;
  div {
    margin-bottom: 2rem;
  }
}

@media (min-width: 46.875rem) {
  .columns {
    display: flex;
    justify-content: space-between;
    gap: 2rem;

    div {
      flex: 1;
      text-wrap: balance;
      margin-bottom: 1rem;
    }
  }
}

.hero {
  background-size: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

@media (min-width: 48rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 16rem;
  }

  .hero img {
    order: 2;
  }
}

@media (min-width: 60rem) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 24rem;
  }
}

.hero h1 {
  margin-bottom: 0.5rem;
  font-size: 2.25rem;
  line-height: 2.5rem;
  font-weight: 700;
}

@media (min-width: 768px) {

  .hero h1 {
    margin-bottom: 1.5rem;
    font-size: 3rem;
    line-height: 1;
  }
}

.hero p {
  margin-bottom: 2rem;
  font-size: 1.15rem;
  line-height: 1.75rem;
  text-wrap: balance;
  max-width: 600px;
}

.hero img {
  width: 100%;
  margin: auto;
}

.external {
  display: none;
}

@media (min-width: 40.625rem) {
  .external {
    display: block;
  }
}

.search {
  margin-bottom: 0;
}

.search-input {
  width: 100%;
  min-width: 6rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5rem;
  padding: 0.375rem 0.75rem 0.375rem 0.5rem;
  padding-left: 2em;
  border: 1px solid;
  transition: all 150ms ease-in-out;
  background: url(/img/search.svg) no-repeat 0.5em 50%;
  background-size: 1em;
  background-color: hsl(var(--foreground-quaternary));
  color: hsl(var(--foreground-primary));
  border-color: hsl(var(--foreground-tertiary));
  &:hover, &:focus {
    background-color: hsl(var(--background-secondary));
  }
}

.theme-toggle {
  flex-shrink: 0;
  height: 2.3rem;
  width: 2.3rem;
  font-size: 0;
  color: transparent;
  background: transparent no-repeat center;
  background-size: 1.5rem;
  cursor: pointer;
  border-radius: 0.25rem;
  border: 1px solid transparent;
  transition: all 200ms ease-in-out;
  color: hsl(var(--foreground-secondary));
  &:hover {
    text-decoration: none;
    background-color: hsl(var(--background-secondary));
    border-color: hsl(var(--background-tertiary));
  }
}

.light .theme-toggle {
  background-image: url(/img/dark.svg);
}

.dark .theme-toggle {
  background-image: url(/img/light.svg);
}

.fourohfour {
  display: grid;
  place-items: center;
  padding: 6rem 5vw 0;
}

lite-youtube {
  background-color: #000;
  position: relative;
  display: block;
  contain: content;
  background-position: center center;
  background-size: cover;
  cursor: pointer;
}

/* gradient */

lite-youtube::before {
  content: attr(data-title);
  display: block;
  position: absolute;
  top: 0;
  /* Pixel-perfect port of YT's gradient PNG, using https://github.com/bluesmoon/pngtocss plus optimizations */
  background-image: linear-gradient(
    180deg,
    rgb(0 0 0 / 67%) 0%,
    rgb(0 0 0 / 54%) 14%,
    rgb(0 0 0 / 15%) 54%,
    rgb(0 0 0 / 5%) 72%,
    rgb(0 0 0 / 0%) 94%
  );
  height: 99px;
  width: 100%;
  font-family: "YouTube Noto", Roboto, Arial, Helvetica, sans-serif;
  color: hsl(0deg 0% 93.33%);
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.5);
  font-size: 18px;
  padding: 25px 20px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

lite-youtube:hover::before {
  color: white;
}

/* responsive iframe with a 16:9 aspect ratio
  thanks https://css-tricks.com/responsive-iframes/
*/

lite-youtube::after {
  content: "";
  display: block;
  padding-bottom: calc(100% / (16 / 9));
}

lite-youtube > iframe {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  border: 0;
}

/* play button */

lite-youtube > .lyt-playbtn {
  display: block;
  /* Make the button element cover the whole area for a large hover/click target… */
  width: 100%;
  height: 100%;
  /* …but visually it's still the same size */
  background: no-repeat center/68px 48px;
  /* YT's actual play button svg */
  background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 48"><path d="M66.52 7.74c-.78-2.93-2.49-5.41-5.42-6.19C55.79.13 34 0 34 0S12.21.13 6.9 1.55c-2.93.78-4.63 3.26-5.42 6.19C.06 13.05 0 24 0 24s.06 10.95 1.48 16.26c.78 2.93 2.49 5.41 5.42 6.19C12.21 47.87 34 48 34 48s21.79-.13 27.1-1.55c2.93-.78 4.64-3.26 5.42-6.19C67.94 34.95 68 24 68 24s-.06-10.95-1.48-16.26z" fill="red"/><path d="M45 24 27 14v20" fill="white"/></svg>');
  position: absolute;
  cursor: pointer;
  z-index: 1;
  filter: grayscale(100%);
  transition: filter 0.1s cubic-bezier(0, 0, 0.2, 1);
  border: 0;
}

lite-youtube:hover > .lyt-playbtn,
lite-youtube .lyt-playbtn:focus {
  filter: none;
}

/* Post-click styles */

lite-youtube.lyt-activated {
  cursor: unset;
}

lite-youtube.lyt-activated::before,
lite-youtube.lyt-activated > .lyt-playbtn {
  opacity: 0;
  pointer-events: none;
}

.lyt-visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  text-align: center;
  margin-top: 0.5rem;
  margin-left: -0.75rem;
  color: hsl(var(--foreground-secondary));
}

@media (min-width: 40rem) {
  .crumbs {
    margin-top: 1rem;
  }
}

.crumb-link {
  display: flex;
  align-items: center;
  &::after {
    content: "";
    width: 1em;
    height: 1em;
    background: url(./img/chevron.svg) no-repeat center;
    display: inline-block;
    margin-left: 1rem;
  }
}

.header-wrapper {
  width: 100%;
  height: var(--header-height);
  position: sticky;
  top: 0;
  border-bottom: 1px solid hsl(var(--foreground-tertiary));

  background-color: var(--background-raw);
  z-index: 100;
}

body:has(.refheader) .header-wrapper {
  border-bottom: 0;
}

header {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  padding-inline: 1rem;
  height: 100%;
  width: 100%;
  max-width: 80rem;
  margin-inline: auto;

  .header-nav-link {
    font-size: clamp(0.8rem, 1.5vw, 1rem);
    white-space: nowrap;
    display: inline-block;
    padding: 0 0.75rem;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    transition: color 200ms ease-in-out;
    color: hsl(var(--foreground-primary));

    &::after {
      content: "";
      height: 100%;
      width: 100%;
      background-color: hsl(var(--header-highlight));
      position: absolute;
      bottom: 0;
      left: 0;
      transition: transform 0.2s cubic-bezier(0.86, 0, 0.07, 1);
      transform-origin: right;
      transform: scaleX(0);
      z-index: -1;
    }

    &:hover, &[data-active] {
      color: hsl(var(--gray-800-hsl));

      &::after {
        transform-origin: left;
        transform: scaleX(1);
      }
    }
  }

  .external {
    margin-left: auto;
  }

  .logo-link {
    display: flex;
    height: 2.3rem;
  }

  .logo {
    width: 100%;
    max-height: 2.5rem;
  }
}

@media (min-width: 82rem) {
  header {
    padding: 0;
  }
}

@media (max-width: 47.9375rem) {
  .logo-link {
    margin-right: auto;
  }
}

.refheader {
  position: sticky;
  top: var(--header-height);
  display: flex;
  align-items: center;
  padding-left: 0;
  background-color: hsl(var(--header-highlight));
  z-index: 5;
  height: var(--subnav-height);
}

.refheader-link {
  white-space: nowrap;
  font-size: clamp(0.875rem, 1vw + 0.5rem, 0.75rem);
  padding: 0;
  color: hsl(var(--gray-800-hsl));
  display: block;
  position: relative;

  &::after {
    content: "";
    display: block;
    width: 100%;
    height: 1px;
    background-color: hsl(var(--gray-800-hsl));
    transform: scaleX(0);
    transition: transform 0.2s cubic-bezier(0.86, 0.0, 0.07, 1);
    transform-origin: right;
    position: absolute;
    bottom: 0;
    left: 0;
  }

  &:hover::after,
  &[data-active="true"]::after {
    transform-origin: left;
    transform: scaleX(1);
  }
}

.refheader-link[data-active="true"] {
  font-weight: bold;
}

.nav[data-section="api"] {
  height: calc(100vh - var(--header-height) - var(--subnav-height));
  top: calc(var(--header-height) + var(--subnav-height));
}

/* putting other reference styles in here for now until they are moved out into components*/

.refcrumbs {
  position: sticky;
  top: calc(var(--header-height) + var(--subnav-height));
  width: 100%;
  padding: 1rem;
  padding-left: 0 !important;
  margin: 0;
  background-color: var(--background-raw);
  z-index: 2;
}

.nav {
  position: fixed;
  top: var(--header-height);
  transition:
    transform 200ms cubic-bezier(0.165, 0.84, 0.44, 1),
    opacity 100ms linear;
  transform: translateX(-100%);
  z-index: 11;
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
  width: 100%;
  min-width: 14rem;
  background: var(--background-raw);
  opacity: 0;
  padding: 1rem;
  overflow: auto;
  font-size: 0.8125rem;
}

body:has(.refheader) .nav {
  top: calc(var(--header-height) + var(--subnav-height));
  height: calc(100vh - var(--header-height) - var(--subnav-height));
  height: calc(100dvh - var(--header-height) - var(--subnav-height));
}

@media (min-width: 48rem) {
  .nav {
    position: sticky;
    top: var(--header-height);
    height: calc(100vh - var(--header-height));
    width: auto;
    min-width: 14rem;
    overflow-y: auto;
    scrollbar-width: thin;
    z-index: 3;
    transform: translateX(0) !important;
    opacity: 1 !important;
    font-size: 0.8125rem;
    padding: 0;
    padding-bottom: 4rem;
  }

  body:has(.refheader) .nav {
    top: calc(var(--header-height) + var(--subnav-height));
    height: calc(100vh - var(--header-height) - var(--subnav-height));
  }
}

.toc-desktop {
  display: none;
}

.toc-list {
  padding: 1rem;
}

@media (min-width: 64rem) {
  .toc-desktop {
    display: block;
    position: sticky;
    padding: 1rem;
    top: 4rem;
    max-width: 300px;
    max-height: calc(100vh - 4rem);
    min-height: -moz-max-content;
    min-height: max-content;
    overflow-y: auto;
    min-width: 10rem;
    border-inline-start: 1px solid hsl(var(--foreground-tertiary));
  }

  .toc-mobile {
    display: none;
  }

  .toc-summary {
    display: none;
  }

  .toc-link:focus,
  .toc-link:hover {
    color: hsl(var(--primary));
  }

  .toc_current-item {
    color: hsl(var(--primary));
  }

  .toc__current-item::before {
    content: "";
    position: absolute;
    left: 0;
    width: 0.5em;
    height: 1.3em;
    background-color: hsl(var(--background-secondary));
    clip-path: polygon(0% 10%, 100% 50%, 0% 90%);
  }
}

@media (min-width: 80rem) {
  .toc-desktop {
    padding-inline-end: 0;
  }
}

body:has(.refheader) .toc-desktop {
  top: calc(var(--header-height) + var(--subnav-height));
}

/* Reference ToC styles */

.documentNavigation.toc-desktop {
  position: sticky;
  top: calc(var(--header-height) + var(--subnav-height));
  font-size: small;
  text-overflow: ellipsis;
  color: hsl(var(--foreground-secondary));

  ul li {
    margin: 0.25rem 0;

    a {
      font-weight: bold;
      line-height: 1.2rem;

      &:hover {
        color: hsl(var(--primary));
        text-decoration: underline;
      }
    }

    ul {
      margin-bottom: 1rem;

      li a {
        font-weight: normal;
      }
    }
  }
}

footer {
  padding: 3rem 1rem 1rem;
  border-top: 1px solid hsl(var(--foreground-tertiary));
}

.footer-nav {
  display: flex;
  flex-direction: column;
  row-gap: 3rem;
}

.footer-section {
  min-width: 170px;
}

.footer-section-heading {
  margin-bottom: 1rem;
  font-size: 1rem;
  font-weight: bold;
  color: hsl(var(--foreground-secondary));
}

.footer-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-link {
  display: block;
  margin-bottom: 0.5rem;
  color: hsl(var(--foreground-secondary));
  &:hover {
    color: var(--primary);
  }
}

.copyright {
  margin: 4rem auto 0;
  text-align: center;
  font-size: 0.9rem;
  color: hsl(var(--foreground-secondary));
}

@media (min-width: 40rem) {
  footer {
    padding-inline: 2rem;
  }
}

@media (min-width: 48rem) {
  .footer-nav {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    width: 100%;
    max-width: 80rem;
    row-gap: 2rem;
    margin: 0 auto;
  }
}

.hamburger-label {
  height: 2rem;
  padding: 0.5rem;
  width: auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border-radius: 0.25rem;
}

.hamburger-label:focus-within {
  outline: 2px solid currentColor;
}

.hamburger-icon {
  :focus {
    border: 2px solid hsl(var(--foreground-primary));
  }
}

.hamburger-bar {
  display: block;
  width: 1.3rem;
  height: 2px;
  background-color: hsl(var(--foreground-primary));
  transition: all 0.3s ease;
}

.hamburger-label:has(.hamburger-checkbox:checked) {
  .hamburger-bar--top {
    transform: translate(0, 7px) rotate(45deg);
  }
  .hamburger-bar--middle {
    opacity: 0;
  }
  .hamburger-bar--bottom {
    transform: translate(0, -7px) rotate(-45deg);
  }
}

body:has(.hamburger-label .hamburger-checkbox:checked) .nav {
  transform: translateX(0);
  opacity: 1;
}

@media screen and (min-width: 48rem) {
  .hamburger-label {
    display: none;
  }
}

.main-nav {
  display: flex;
  flex-direction: column;
  padding: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(var(--background-tertiary));
  background-color: hsl(var(--background-secondary));
  list-style: none;
  margin-block-end: 1rem;
}

.main-nav-link {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 0.25rem;
  color: hsl(var(--foreground-primary));
  &:hover {
    background-color: hsl(var(--background-tertiary));
    text-decoration: none;
  }
}

.main-nav-link[data-active] {
  font-weight: bold;
  background-color: hsl(var(--background-tertiary));
}

@media (min-width: 48rem) {
  .main-nav {
    margin-block-start: 1rem;
    margin-inline-end: 1rem;
  }
}

@media (min-width: 64rem) {
  .main-nav {
    display: none;
  }
}

li:has(.sub-nav-toggle) {
  border-left: 1px solid hsl(var(--foreground-tertiary));
}

li:has(.sub-nav-toggle:hover) {
  border-left-color: hsl(var(--foreground-secondary));
}

.sub-nav-toggle:hover {
  background-color: hsl(var(--header-highlight));
}

.sub-nav-toggle {
  display: block;
  position: relative;
  font: inherit;
  padding: 0.25rem 0.75rem;

  &::after {
    content: "";
    display: block;
    width: 1rem;
    height: 1rem;
    position: absolute;
    right: 0.5rem;
    top: -0.25rem;
    background: url(./img/chevron.svg) no-repeat center;
    transform: translateY(50%);
    transition: transform 0.1s ease-in;
  }
}

li:has(> .sub-nav-toggle) {
  display: grid;
  grid-template-rows: max-content 0fr;
  transition: grid 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.sub-nav-toggle + ul {
  margin-left: 1rem;
}

li:has(> .sub-nav-toggle .sub-nav-toggle-checkbox:checked),
li:has(> .sub-nav-toggle + ul:focus-within) {
  grid-template-rows: max-content 1fr;
  padding-bottom: 1rem;
}

.sub-nav-toggle:has(.sub-nav-toggle-checkbox:checked)::after,
.sub-nav-toggle:has(+ ul:focus-within)::after {
  transform: translateY(50%) rotate(90deg);
}

h1.ref-h1 {
  font-size: 1.6rem;
  border: 0;
  padding: 0;
}

code.inline-code-block {
  display: inline-block;
  margin-bottom: 1rem;
  padding: 1rem;
}

hr.hr {
  height: 1px;
}

.anchorable-heading .context-link {
  color: hsl(var(--foreground-primary));
}