/* Inter and JetBrains Mono are loaded from Google Fonts by main.html. */
:root {
  --md-primary-fg-color: #ffffff;
  --md-primary-fg-color--dark: #0d4984;
  --md-primary-fg-color--light: #6593c8;
  --md-primary-bg-color: #182230;
  --md-accent-fg-color: #1261bd;
  --md-accent-fg-color--transparent: #1261bd1a;
  --nav-item-color: #475467;
  --md-footer-bg-color: #081729;
  --md-default-fg-color: #182230;
  --md-default-fg-color--light: #667085;
  --md-typeset-a-color: #1d67da;
  --md-text-font: 'Inter';
  --md-code-font: 'JetBrains Mono';
  --site-nav-bg: #14385d;
  --site-nav-text: #d4e3f4;
  --site-nav-focus: #9bd5ff;
}

/* Deep-navy canvas for elastic overscroll; regular page content stays white. */
html,
body {
  background-color: var(--md-footer-bg-color);
}

.md-container {
  background-color: var(--md-default-bg-color, #fff);
}

.md-clipboard {
  color: var(--md-primary-fg-color--dark);
}

.md-content__button {
  color: var(--md-default-fg-color--light);
}

.highlight.no-copy .md-clipboard {
  display: none;
}

.md-header__button.md-logo {
  display: block;
}

.md-header__button.md-logo :is(img, svg) {
  width: 2.1rem;
  height: 1.7rem;
  object-fit: contain;
}

.md-nav__item--nested > .md-nav__link,
.md-nav__item a {
  color: var(--nav-item-color);
}

.md-nav__item .md-nav__link--active {
  font-weight: 600;
  color: var(--md-typeset-a-color);
}

.md-nav__item--nested > .md-nav__link:hover {
  color: var(--md-accent-fg-color);
}

/* Let navigation scroll freely, including the site links above the first section. */
.md-nav--primary .md-nav__title ~ .md-nav__list {
  scroll-snap-type: none;
}

/* Quiet navigation chrome; Material still owns search and drawer behavior. */
.md-header {
  color: #f4f8ff;
  background: var(--site-nav-bg);
  border-bottom: 0;
  box-shadow: none;
}

.md-header__inner {
  min-height: 3.2rem;
}

.md-header .md-header__title {
  margin-inline-start: 0.3rem;
}

.md-header .site-brand {
  color: inherit;
}

.md-header[data-md-state='shadow'] {
  box-shadow: none;
}

.md-tabs {
  background: #fff;
  color: var(--nav-item-color);
}

.md-tabs__link {
  opacity: 1;
}

.md-tabs__item--active .md-tabs__link {
  color: var(--md-typeset-a-color);
  font-weight: 500;
}

.site-links {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  margin: 0 1.5rem 0 auto;
  padding: 0;
  list-style: none;
  font-size: 0.7rem;
  line-height: 1.5;
}

.site-links a {
  color: var(--site-nav-text);
}

body:not(:has(.home-page)) .md-header .site-links a,
body:not(:has(.home-page)) .md-tabs__link {
  font-weight: 550;
}

.site-links a:hover,
.site-links a[aria-current] {
  color: #fff;
}

.site-links--drawer,
.knative-site-navigation {
  display: none;
}

.drawer-github {
  gap: 0.4rem;
}

.drawer-github svg {
  width: 0.9rem;
  height: 0.9rem;
  fill: currentColor;
}

.site-github {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.2rem;
  margin-inline-start: 0.8rem;
  color: var(--site-nav-text);
  font-size: 0.7rem;
}

.site-github svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

.site-github-info {
  width: 5.2rem;
  line-height: 1.3;
}

.site-github .md-source__facts {
  gap: 0.5rem;
  margin-top: 0.1rem;
  font-size: 0.55rem;
  opacity: 0.85;
}

.site-github .md-source__fact--version {
  display: none;
}

.site-github:hover {
  color: #fff;
}

.md-header a:focus-visible {
  outline: 2px solid var(--site-nav-focus);
  outline-offset: 4px;
}

.md-header__button:focus-visible {
  outline-color: var(--site-nav-focus);
}

/* Keep Material's drawer styling, but move site links there only below 48em. */
@media (max-width: 76.234375em) {
  .site-github {
    padding-inline: 0.4rem;
  }

  .site-github-info {
    display: none;
  }

  .md-nav--primary > .md-nav__title[for='__drawer'],
  .md-nav--primary .md-nav .md-nav__title {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    height: auto;
    padding: 0.6rem 0.8rem;
    background: var(--site-nav-bg);
    color: #fff;
  }

  .md-nav--primary > .md-nav__title[for='__drawer'] {
    flex-shrink: 0;
    min-height: 3.6rem;
  }

  .md-nav--primary > .md-nav__title .md-logo {
    position: static;
    flex: 0 0 2.4rem;
    margin: 0;
    padding: 0;
  }

  .md-nav--primary > .md-nav__title .md-nav__button.md-logo :is(img, svg) {
    display: block;
    width: 2.4rem;
    height: 2.4rem;
    object-fit: contain;
  }

  .md-nav--primary {
    background-color: var(--site-nav-bg);
  }

  .md-nav--primary .md-nav .md-nav__title {
    min-height: 2.8rem;
    line-height: 1.5;
  }

  .md-nav--primary .md-nav .md-nav__title .md-nav__icon {
    position: static;
    flex: 0 0 1rem;
    width: 1rem;
    height: 1rem;
    margin: 0;
  }

  .md-nav--primary > .md-nav__list {
    overflow-x: hidden;
  }

  .md-nav--primary .md-nav__list > .md-nav__item {
    background-color: var(--md-default-bg-color, #fff);
  }

  .site-links--drawer {
    margin: 0;
    padding: 0;
    background: var(--site-nav-bg);
    font-size: 0.8rem;
  }

  .site-links--drawer a {
    display: flex;
    align-items: center;
    min-height: 2.4rem;
    padding: 0.6rem 0.8rem;
  }

  .site-links--drawer a[aria-current] {
    font-weight: 600;
  }

  .site-links--drawer a:focus-visible {
    outline: 2px solid var(--site-nav-focus);
    outline-offset: -4px;
  }
}

/* First collapse search to its icon, retaining site links at tablet widths. */
@media (min-width: 60em) and (max-width: 76.234375em) {
  .md-header__inner {
    position: relative;
  }

  .md-header__button[for='__search'] {
    display: block;
  }

  .md-header__inner > .md-search {
    position: absolute;
    inset-inline-end: 0;
    top: calc(50% - 0.9rem);
    height: 1.8rem;
    padding: 0;
  }

  .md-header__inner > .md-search .md-search__inner {
    position: absolute;
    inset-inline-end: 0;
    top: 0;
  }

  body:not(:has(#__search:checked)) .md-header .md-search {
    display: none;
  }
}

/* The homepage does not need an empty drawer while its site links are visible. */
@media (min-width: 48em) and (max-width: 76.234375em) {
  body:has(.home-page) .md-header__button[for='__drawer'] {
    display: none;
  }
}

/* Once site links no longer fit, show them in the drawer instead. */
@media (max-width: 47.984375em) {
  .md-header__inner .site-links {
    display: none;
  }

  .md-nav--primary > .md-nav__list > .knative-site-navigation,
  .site-links--drawer {
    display: block;
  }
}

/* Expand desktop search over the header without reflowing the navigation. */
@media (min-width: 76.25em) {
  .md-header__inner > .md-search {
    flex: 0 0 11.7rem;
    height: 1.8rem;
  }

  .md-header__inner > .md-search .md-search__inner {
    position: absolute;
    inset-inline-end: 0;
    top: 0;
  }
}

.md-search__form {
  border: 1px solid #d0d5dd;
  border-radius: 0.35rem;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
}

.md-search__input::placeholder {
  color: var(--md-default-fg-color--light);
}

.md-search__icon[for='__search'] {
  color: var(--md-default-fg-color--light);
}

/* Match the blue header when closed; the expanded search panel stays white. */
body:not(:has(#__search:checked)) .md-header .md-search__form {
  background: #214d76;
  border-color: #6c8cab;
  color: #edf3fc;
}

body:not(:has(#__search:checked)) .md-header .md-search__input {
  color: #edf3fc;
}

body:not(:has(#__search:checked)) .md-header .md-search__input::placeholder,
body:not(:has(#__search:checked)) .md-header .md-search__icon[for='__search'] {
  color: #c6d8ed;
}

.md-nav__title .md-nav__button.md-logo img,
.md-nav__title .md-nav__button.md-logo svg {
  width: auto;
}

/* Let Material supply the type scale and spacing; tune only the reading rhythm. */
.md-typeset {
  font-size: 0.825rem;
  line-height: 1.7;
}

.md-typeset :is(h1, h2, h3, h4, h5, h6) {
  color: #101828;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.md-typeset h1 {
  line-height: 1.2;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.md-typeset :is(strong, b, dt, th) {
  font-weight: 600;
}

.md-typeset a {
  overflow-wrap: anywhere;
}

/* Ink/link colors differ by over 3:1; reserve persistent underlines for utilities. */
.md-typeset blockquote {
  color: var(--md-default-fg-color);
}

/* Linked cards and logos are not prose links. Decorate only inline text on hover. */
.md-typeset :is(p, li) > a:not(.md-button):not(.headerlink):hover {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.md-typeset code {
  font-size: max(0.65rem, 0.8em);
  font-variant-ligatures: none;
}

.md-typeset pre > code {
  line-height: 1.6;
}

/* Imported blog HTML uses bare pre elements rather than fenced code wrappers. */
.md-typeset pre:not(:has(> code)):not(.mermaid) {
  overflow-x: auto;
  padding: 0.8rem;
  background: var(--md-code-bg-color);
  font-family: var(--md-code-font-family);
  font-size: 0.65rem;
  line-height: 1.6;
}

.md-typeset :is(.admonition, details) {
  font-size: 0.9em;
  line-height: 1.65;
}

/* Wide technical diagrams remain inspectable at their native size. */
.md-typeset .diagram-link {
  display: block;
  margin-block: 1.5em;
  background: #fff;
  cursor: zoom-in;
}

.md-typeset .diagram-link img {
  display: block;
  width: 100%;
  height: auto;
}

.md-typeset .diagram-link:focus-visible {
  outline: 2px solid #1261bd;
  outline-offset: 4px;
}

/* Keep the homepage brand and versioned site titles visible after scrolling. */
.knative-header__title--versioned {
  min-width: 11rem;
}

.knative-header__title--static .md-header__topic:first-child {
  opacity: 1;
  pointer-events: auto;
  transform: none;
  z-index: 0;
}

.knative-header__title--static .md-header__topic + .md-header__topic {
  display: none;
}

/* The toolbar must stack above the second navigation row while the menu is open. */
.md-header__inner:has(.knative-version-selector[open]) {
  position: relative;
  z-index: 10;
}

/* Use Material's original version-picker styles with native details behavior. */
.knative-version-selector {
  --knative-version-gap: 1rem;
  --knative-version-padding: 0.4rem;
  position: relative;
  line-height: 2.4rem;
  font-weight: 400;
}

.knative-version-selector .md-version__current {
  margin-inline: var(--knative-version-gap) 0.4rem;
  list-style: none;
  white-space: nowrap;
}

.knative-version-selector summary::-webkit-details-marker {
  display: none;
}

/* Keep text aligned while leaving a gap between the popup and the site name. */
.knative-version-selector > .md-version__list {
  inset-inline-start: calc(
    var(--knative-version-gap) - var(--knative-version-padding)
  );
  margin-inline: 0;
  /* Include the control's caret and its end margin, even for (Pre-release). */
  min-width: calc(
    100% - var(--knative-version-gap) + var(--knative-version-padding)
  );
  width: max-content;
}

.knative-version-selector[open] > .md-version__list {
  z-index: 10;
  background-color: var(--md-default-bg-color, #fff);
  max-height: 10rem;
  opacity: 1;
  animation: none;
  transition:
    max-height 0ms,
    opacity 0.25s;
}

.knative-version-selector .md-version__link {
  padding-inline: var(--knative-version-padding);
}

.knative-version-selector .md-version__item {
  line-height: 1.6rem;
}

.knative-version-selector .md-version__item:last-child a {
  color: var(--md-default-fg-color--light);
}

.knative-version-selector summary:focus-visible,
.knative-version-selector[open]:has(> summary:focus-visible)
  > .md-version__list {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.knative-version-selector[open] > summary:focus-visible {
  outline: none;
}

/* bit of a hack to stop the banner taking space when empty */
.md-banner .md-banner__inner {
  margin: 0 auto;
  padding: 0;
}

.md-banner {
  background: #fff5b5;
}

.md-banner:has(.site-announcement) {
  background: #0d4984;
}

.site-announcement {
  color: #fff;
  font-weight: 600;
  padding: 0.6rem 0.8rem;
  text-align: center;
}

.md-banner .site-announcement a {
  color: #fff;
  margin-left: 0.5rem;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.versionwarning {
  width: min(100% - 2rem, 60rem);
  margin-inline: auto;
  padding-block: 0.75rem;
}

.md-banner .versionwarning h1 {
  margin: 0;
  color: #5d4715;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.5;
}

.md-banner .versionwarning p {
  margin: 0.4rem 0 0;
  color: #5d4715;
  font-size: 0.65rem;
  line-height: 1.6;
}

.md-banner .versionwarning a {
  color: #175cd3;
}

.md-banner a {
  color: blue;
  text-decoration: underline;
}

.md-typeset table:not([class]) {
  font-size: 0.9em;
}

/* Action colors are independent of Material's header foreground/background. */
.md-typeset .md-button,
.md-typeset .md-button:focus {
  min-height: 2.2rem;
  padding: 0.6rem 1rem;
  border: 1px solid #125cb3;
  border-radius: 0.35rem;
  background: transparent;
  color: #125cb3;
  font-size: 0.7rem;
  font-weight: 500;
  line-height: 1.5;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    color 0.15s;
}

/* Text actions do not need ornamental arrow/plane glyphs. Icon-only controls use md-icon. */
.md-typeset .md-button .twemoji {
  display: none;
}

.md-typeset .md-button:hover {
  color: #0d4984;
  background: #eaf3fc;
  border-color: #0d4984;
}

.md-typeset .md-button--primary,
.md-typeset .md-button--primary:focus {
  color: #fff;
  background: #125cb3;
  border-color: #125cb3;
}

.md-typeset .md-button--primary:hover {
  color: #fff;
  background: #0d4984;
  border-color: #0d4984;
}

.md-typeset .md-button:active {
  color: #0d4984;
  background: #dceaf7;
  border-color: #0d4984;
}

.md-typeset .md-button--primary:active {
  color: #fff;
  background: #0a3868;
  border-color: #0a3868;
}

.md-typeset .md-button:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 3px;
}

.md-typeset .md-button:disabled {
  color: #667085;
  background: #f2f4f7;
  border-color: #d0dae5;
  cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
  .md-typeset .md-button,
  .md-typeset .md-button:focus {
    transition: none;
  }
}

/* fix wrapping behavior of code in tables */
.md-typeset table code {
  word-break: normal;
}

/* Cookie controls keep their existing behavior, with scoped, normal-flow layout. */
body.modal-open {
  overflow: hidden;
}

#cookieModal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  overflow-y: auto;
  background: #10182866;
  outline: 0;
}

#cookieModal .modal-dialog {
  width: min(36rem, calc(100% - 2rem));
  margin: 5vh auto;
  color: var(--md-default-fg-color);
}

#cookieModal .modal-content {
  background: #fff;
  border: 1px solid #d0dae5;
  border-radius: 0.5rem;
  box-shadow: 0 1rem 3rem #10182833;
}

#cookieModal .modal-body {
  padding: 1.25rem;
}

#cookieModal .consent-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

#cookieModal .opt-out {
  display: none;
  flex-basis: 100%;
}

.cookienotice {
  position: fixed;
  inset: auto 0 0;
  z-index: 1000;
  display: none;
  background: #f8fafc;
  border-top: 1px solid #e4e7ec;
  color: #475467;
}

.cookienotice__inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 1rem;
  width: min(100% - 2rem, 60rem);
  margin-inline: auto;
  padding-block: 0.75rem;
}

.cookienotice .text {
  font-size: 0.675rem;
  line-height: 1.55;
}

.cookienotice .text p {
  margin: 0;
}

.cookienotice .text a {
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.cookienotice .buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cookienotice .buttons button {
  min-width: 2.2rem;
  min-height: 2.2rem;
  border: 0;
  cursor: pointer;
}

.cookienotice .ok {
  padding: 0.4rem 0.75rem;
  border-radius: 0.25rem;
  color: #fff;
  background: var(--md-primary-fg-color--dark);
  font-size: 0.675rem;
}

.cookienotice .close {
  background: transparent;
  color: #667085;
  font-size: 1.4rem;
  line-height: 1;
}

.cookienotice .ok:hover {
  background: #0a3868;
}

.cookienotice .ok:active {
  background: #072b50;
}

.cookienotice .close:hover {
  color: #182230;
}

.cookienotice button:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 3px;
}

/* Footer information shares the outer reading grid and wraps naturally. */
.md-footer {
  color: var(--md-footer-fg-color);
  background: var(--md-primary-fg-color--dark);
}

.md-footer-meta {
  background: var(--md-footer-bg-color);
  font-size: 0.65rem;
  line-height: 1.6;
}

.md-footer-meta__inner {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(0, 2fr);
  align-items: start;
  gap: 0.75rem 2rem;
  width: min(100% - 2rem, 60rem);
  margin-inline: auto;
  padding-block: 1.5rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  grid-column: 2;
  grid-row: 1 / 3;
}

.footer-links a {
  color: var(--md-footer-fg-color--light);
}

.footer-links a:hover {
  text-decoration: underline;
}

.md-footer-meta__inner .md-social {
  grid-column: 1;
  margin: 0;
  padding: 0;
}

@media (max-width: 700px) {
  .md-footer-meta__inner {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .footer-links {
    grid-column: 1;
    grid-row: auto;
  }
}

/* Feature State Labels */
.feature-alpha,
.feature-beta,
.feature-stable {
  font-variant: small-caps;
  padding: 0.1em;
  border-bottom: 1px dotted #999;
  display: inline-block;
  font-weight: bold;
}

.feature-alpha {
  background: rgb(255, 218, 218);
}

.feature-beta {
  background: rgb(251, 244, 182);
}

.feature-stable {
  background: rgb(228, 255, 218);
}

/* Case studies share a real layout, not a two-column data table. */
.case-study {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 2fr);
  align-items: start;
  gap: 2rem;
}

.case-study__summary {
  padding-top: 0.3rem;
}

.case-study__logo {
  display: block;
  width: min(100%, 10rem);
  max-height: 4rem;
  object-fit: contain;
  object-position: left;
  margin-bottom: 1.25rem;
}

.md-typeset .case-study__summary blockquote {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--md-default-fg-color);
  font-size: 0.75rem;
  line-height: 1.65;
}

.case-study__attribution {
  color: var(--md-default-fg-color--light);
  font-size: 0.65rem;
}

.case-study__body > h2:first-child {
  margin-top: 0;
}

.case-study-index {
  display: grid;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.case-study-index > a {
  display: grid;
  grid-template-columns: 9rem minmax(0, 1fr);
  align-items: center;
  gap: 1.5rem;
  padding-block: 1.25rem;
  color: var(--md-default-fg-color);
}

.case-study-index img {
  width: 8rem;
  max-height: 3rem;
  object-fit: contain;
  object-position: left;
}

.case-study-index > a:hover {
  color: var(--md-typeset-a-color);
}

.case-study-index > a:focus-visible {
  outline: 2px solid var(--md-accent-fg-color);
  outline-offset: 3px;
}

@media (max-width: 700px) {
  .case-study {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .case-study-index > a {
    grid-template-columns: 6rem minmax(0, 1fr);
    gap: 0.75rem;
  }

  .case-study-index img {
    width: 6rem;
  }
}

/* Testimonials follow the reading grid, without negative heading margins. */
.testimonials > h3 {
  font-size: 1.05rem;
  line-height: 1.45;
}

.testimonials > h3 b {
  font-weight: 500;
}

.testimonials > br {
  display: none;
}

.testimonials .normal-text {
  color: var(--md-default-fg-color);
  font-weight: 400;
}

.testimonials .testimonial {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  align-items: start;
  gap: 1.5rem;
  margin-block: 2rem;
  padding-block: 1.5rem;
}

.testimonials .testimonial .img {
  margin: 0;
}

.testimonials .testimonial img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 0.35rem;
}

.testimonials .quote {
  color: var(--md-default-fg-color--light);
  font-family: inherit;
  font-size: 0.7rem;
  line-height: 1.7;
}

.testimonials .quote .phrase {
  color: #101828;
  font-size: 1.1rem;
  font-weight: 450;
  line-height: 1.5;
  letter-spacing: -0.02em;
}

.testimonials .testimonial.blue {
  padding: 1.5rem;
  background: #edf4fb;
}

.testimonials .testimonial.blue .quote {
  color: var(--md-default-fg-color);
  font-size: 0.825rem;
}

.testimonials .find-links {
  display: grid;
  gap: 0.75rem;
  margin-top: 1rem;
}

.testimonials .find-links br {
  display: none;
}

@media (max-width: 530px) {
  #cookieModal .md-button {
    width: 100%;
  }

  .cookienotice__inner {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .cookienotice .buttons {
    justify-self: end;
  }

  .testimonials .testimonial {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .testimonials .testimonial .img {
    width: 4rem;
  }
}

@media (max-width: 630px) {
  .site-github {
    display: none;
  }

  .knative-header__title--versioned {
    min-width: 0;
  }

  .knative-version-selector {
    --knative-version-gap: 0.3rem;
  }

  .knative-header__title--versioned
    .md-header__topic:first-child
    > .md-ellipsis {
    display: none;
  }
}

.md-search-result__article {
  max-height: none;
}

.md-search-result__teaser,
article.md-search-result__article p:not(.md-search-result__meta) {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.5;
  max-height: 4.5em;
}
